home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / tex-k / tex-k-archive.past / tex-k-archive.gz / tex-k-archive / 000451_bruno@alpha1.csd.uwm.edu_Sat Apr 2 08:03:07 1994.msg < prev    next >
Internet Message Format  |  1994-10-11  |  87KB

  1. Received: from alpha1.csd.uwm.edu by cs.umb.edu with SMTP id AA26480
  2.   (5.65c/IDA-1.4.4 for <tex-k@cs.umb.edu>); Sat, 2 Apr 1994 15:03:53 -0500
  3. Received: (bruno@localhost) by alpha1.csd.uwm.edu (8.6.7/8.6.8) id OAA04614 for tex-k@cs.umb.edu; Sat, 2 Apr 1994 14:03:07 -0600
  4. Date: Sat, 2 Apr 1994 14:03:07 -0600
  5. From: Bruno Wolff III <bruno@alpha1.csd.uwm.edu>
  6. Message-Id: <199404022003.OAA04614@alpha1.csd.uwm.edu>
  7. To: tex-k@cs.umb.edu
  8. Subject: more on dviljk
  9.  
  10. There is a mistake in the PJL LANGUAGE command. On our 4si this ends up with
  11. the print job being ignored.
  12. The alpha change also required more than just setting long to be int. That
  13. did seem to work in my test cases for the LJ and LJ2P drivers, but not always
  14. for the LJ4 driver. The problem is that there are scanf and printf format
  15. codes that specifiy long words. What I ended up doing is changing most longs
  16. to long4 which is a macro for either long or int. This left "long" still
  17. available to properly type cast stuff. I left some external functions and
  18. scanf'd variables as long. I am not really sure I did this completely right,
  19. but dvilj, dvilj2p and dvilj4 seem to be working OK on our alpha under OSF
  20. using gcc. I have included context diffs for the stuff I have changed.
  21. *** Makefile.in.orig    Thu Mar  3 12:55:44 1994
  22. --- Makefile.in    Fri Apr  1 17:26:07 1994
  23. ***************
  24. *** 18,24 ****
  25.   scriptdir = $(bindir)
  26.   libdir = $(exec_prefix)/lib
  27.   datadir = $(prefix)/lib
  28. ! infodir = $(prefix)/info
  29.   includedir = $(prefix)/include
  30.   manext = 1
  31.   mandir = $(prefix)/man/man$(manext)
  32. --- 18,24 ----
  33.   scriptdir = $(bindir)
  34.   libdir = $(exec_prefix)/lib
  35.   datadir = $(prefix)/lib
  36. ! infodir = $(prefix)/gnu/info
  37.   includedir = $(prefix)/include
  38.   manext = 1
  39.   mandir = $(prefix)/man/man$(manext)
  40. ***************
  41. *** 82,88 ****
  42.   # End of installation directory definitions.
  43.   
  44.   # See INSTALL for compilation options.
  45. ! DEFS = -DLJ4 $(XDEFS)
  46.   
  47.   CC = @CC@
  48.   # CFLAGS is used for both compilation and linking.
  49. --- 82,88 ----
  50.   # End of installation directory definitions.
  51.   
  52.   # See INSTALL for compilation options.
  53. ! DEFS = $(XDEFS) -DMAKETEXPK_BY_DEFAULT -DMFMODE=\"\"
  54.   
  55.   CC = @CC@
  56.   # CFLAGS is used for both compilation and linking.
  57. ***************
  58. *** 117,123 ****
  59.   srcdir = @srcdir@
  60.   VPATH = @srcdir@
  61.   
  62. ! objects = dvi2xx.o tfm.o
  63.   
  64.   makeargs = $(MFLAGS) SHELL='$(SHELL)' CC='$(CC)' CFLAGS='$(CFLAGS)' $(MAKEARGS)
  65.   installargs = INSTALL='$(INSTALL)' INSTALL_DATA='$(INSTALL_DATA)' \
  66. --- 117,125 ----
  67.   srcdir = @srcdir@
  68.   VPATH = @srcdir@
  69.   
  70. ! objects = dvi2lj.o tfm.o
  71. ! objects2p = dvi2lj2p.o tfm.o
  72. ! objects4 = dvi2lj4.o tfm.o
  73.   
  74.   makeargs = $(MFLAGS) SHELL='$(SHELL)' CC='$(CC)' CFLAGS='$(CFLAGS)' $(MAKEARGS)
  75.   installargs = INSTALL='$(INSTALL)' INSTALL_DATA='$(INSTALL_DATA)' \
  76. ***************
  77. *** 125,136 ****
  78.     bh_fontdir=$(bh_fontdir) cg_fontdir=$(cg_fontdir) mt_fontdir=$(mt_fontdir)
  79.   
  80.   program = dvilj
  81.   
  82. ! all: $(program)
  83.   
  84.   $(program): $(objects) $(kpathsea)
  85.       $(CC) $(LDFLAGS) -o $(program) $(objects) $(LOADLIBES)
  86.   
  87.   $(kpathsea): $(kpathsea_srcdir)/*.c $(kpathsea_srcdir)/*.h
  88.       cd $(kpathsea_dir); $(MAKE) $(makeargs)
  89.   
  90. --- 127,155 ----
  91.     bh_fontdir=$(bh_fontdir) cg_fontdir=$(cg_fontdir) mt_fontdir=$(mt_fontdir)
  92.   
  93.   program = dvilj
  94. + program2p = dvilj2p
  95. + program4 = dvilj4
  96.   
  97. ! all: $(program) $(program2p) $(program4)
  98.   
  99.   $(program): $(objects) $(kpathsea)
  100.       $(CC) $(LDFLAGS) -o $(program) $(objects) $(LOADLIBES)
  101.   
  102. + $(program2p): $(objects2p) $(kpathsea)
  103. +     $(CC) $(LDFLAGS) -o $(program2p) $(objects2p) $(LOADLIBES)
  104. + $(program4): $(objects4) $(kpathsea)
  105. +     $(CC) $(LDFLAGS) -o $(program4) $(objects4) $(LOADLIBES)
  106. + dvi2lj.o:    dvi2xx.c
  107. +     $(CC) $(CPPFLAGS) $(CFLAGS) -DLJ -c dvi2xx.c -o dvi2lj.o
  108. + dvi2lj2p.o:    dvi2xx.c
  109. +     $(CC) $(CPPFLAGS) $(CFLAGS) -DLJ2P -c dvi2xx.c -o dvi2lj2p.o
  110. + dvi2lj4.o:    dvi2xx.c
  111. +     $(CC) $(CPPFLAGS) $(CFLAGS)  -DLJ4 -c dvi2xx.c -o dvi2lj4.o
  112.   $(kpathsea): $(kpathsea_srcdir)/*.c $(kpathsea_srcdir)/*.h
  113.       cd $(kpathsea_dir); $(MAKE) $(makeargs)
  114.   
  115. ***************
  116. *** 138,148 ****
  117.   install: install-exec install-data
  118.   uninstall: uninstall-exec uninstall-data
  119.   
  120. ! install-exec: $(program)
  121.       $(SHELL) $(srcdir)/../mkdirchain $(bindir)
  122.       $(INSTALL_PROGRAM) $(program) $(bindir)/$(program)
  123.   uninstall-exec:
  124.       rm -f $(bindir)/$(program)
  125.   
  126.   install-data:
  127.   # Man page.
  128. --- 157,171 ----
  129.   install: install-exec install-data
  130.   uninstall: uninstall-exec uninstall-data
  131.   
  132. ! install-exec: $(program) $(program2p) $(program4)
  133.       $(SHELL) $(srcdir)/../mkdirchain $(bindir)
  134.       $(INSTALL_PROGRAM) $(program) $(bindir)/$(program)
  135. +     $(INSTALL_PROGRAM) $(program2p) $(bindir)/$(program2p)
  136. +     $(INSTALL_PROGRAM) $(program4) $(bindir)/$(program4)
  137.   uninstall-exec:
  138.       rm -f $(bindir)/$(program)
  139. +     rm -f $(bindir)/$(program2p)
  140. +     rm -f $(bindir)/$(program4)
  141.   
  142.   install-data:
  143.   # Man page.
  144. ***************
  145. *** 241,247 ****
  146.   
  147.   
  148.   mostlyclean::
  149. !     rm -f *.o $(program) $(lib) $(programs)
  150.   
  151.   clean:: mostlyclean
  152.       rm -f *.dvi *.lj
  153. --- 264,270 ----
  154.   
  155.   
  156.   mostlyclean::
  157. !     rm -f *.o $(program) $(program2p) $(program4) $(lib) $(programs)
  158.   
  159.   clean:: mostlyclean
  160.       rm -f *.dvi *.lj
  161. ***************
  162. *** 280,286 ****
  163.               -e 's,/usr[^ ]* ,,g' \
  164.         | uniq \
  165.         >depend.make
  166. ! dvi2xx.o : dvi2xx.c config.h $(kpathsea_dir)/config.h ./c-auto.h $(kpathsea_dir)/c-std.h \
  167.     $(kpathsea_dir)/c-unistd.h \
  168.     $(kpathsea_dir)/systypes.h \
  169.     $(kpathsea_dir)/c-memstr.h \
  170. --- 303,309 ----
  171.               -e 's,/usr[^ ]* ,,g' \
  172.         | uniq \
  173.         >depend.make
  174. ! dvi2lj.o dvi2lj2p.o dvi2lj4 : dvi2xx.c config.h $(kpathsea_dir)/config.h ./c-auto.h $(kpathsea_dir)/c-std.h \
  175.     $(kpathsea_dir)/c-unistd.h \
  176.     $(kpathsea_dir)/systypes.h \
  177.     $(kpathsea_dir)/c-memstr.h \
  178. *** config.h.orig    Thu Mar  3 11:20:38 1994
  179. --- config.h    Sat Apr  2 11:12:13 1994
  180. ***************
  181. *** 91,98 ****
  182.   #define  ARITHMETIC_RIGHT_SHIFT
  183.   #endif
  184.   
  185. ! #ifdef alpha
  186. ! #define long int
  187.   #endif
  188.   
  189.   bool findfile();
  190. --- 91,100 ----
  191.   #define  ARITHMETIC_RIGHT_SHIFT
  192.   #endif
  193.   
  194. ! #ifdef LONG_64_BITS
  195. ! #define long4 int
  196. ! #else
  197. ! #define long4 long
  198.   #endif
  199.   
  200.   bool findfile();
  201. ***************
  202. *** 203,207 ****
  203.     /* TFM files can always have 256 characters, even if we're using the
  204.        old pixel format that only supports 128. The values are fix-words
  205.        scaled by the design size; i.e., straight from the TFM file. */
  206. !   long widths[256];
  207.   } tfm_info_type;
  208. --- 205,209 ----
  209.     /* TFM files can always have 256 characters, even if we're using the
  210.        old pixel format that only supports 128. The values are fix-words
  211.        scaled by the design size; i.e., straight from the TFM file. */
  212. !   long4 widths[256];
  213.   } tfm_info_type;
  214. *** configure.in.orig    Thu Feb 24 14:22:59 1994
  215. --- configure.in    Fri Apr  1 23:11:54 1994
  216. ***************
  217. *** 2,6 ****
  218. --- 2,7 ----
  219.   AC_INIT(dvi2xx.c)
  220.   
  221.   sinclude(../kpathsea/common.ac)
  222. + AC_LONG_64_BITS
  223.   
  224.   AC_OUTPUT(Makefile fonts/Makefile)
  225. *** configure.orig    Fri Feb 25 13:16:06 1994
  226. --- configure    Fri Apr  1 23:11:59 1994
  227. ***************
  228. *** 244,250 ****
  229.   test -n "$RANLIB" && test -n "$verbose" && echo "    setting RANLIB to $RANLIB"
  230.   
  231.   
  232.   echo checking for POSIXized ISC
  233.   if test -d /etc/conf/kconfig.d &&
  234.     grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
  235. --- 244,249 ----
  236. ***************
  237. *** 656,661 ****
  238. --- 655,683 ----
  239.     extrasub='/^[     ]*VPATH[     ]*=[     ]*/d'
  240.     
  241.   fi
  242. + echo checking for 64-bit long ints
  243. + cat > conftest.c <<EOF
  244. + #include "confdefs.h"
  245. + main() { exit(sizeof(long int) != 8); }
  246. + EOF
  247. + eval $compile
  248. + if test -s conftest && (./conftest; exit) 2>/dev/null; then
  249. +   
  250. + {
  251. + test -n "$verbose" && \
  252. + echo "    defining LONG_64_BITS"
  253. + echo "#define" LONG_64_BITS 1 >> confdefs.h
  254. + DEFS="$DEFS -DLONG_64_BITS=1"
  255. + SEDDEFS="${SEDDEFS}\${SEDdA}LONG_64_BITS\${SEDdB}LONG_64_BITS\${SEDdC}1\${SEDdD}
  256. + \${SEDuA}LONG_64_BITS\${SEDuB}LONG_64_BITS\${SEDuC}1\${SEDuD}
  257. + \${SEDeA}LONG_64_BITS\${SEDeB}LONG_64_BITS\${SEDeC}1\${SEDeD}
  258. + "
  259. + }
  260. + fi
  261. + rm -fr conftest*
  262.   
  263.   
  264.   # Set default prefixes.
  265. *** dvi2xx.c.orig    Thu Mar  3 12:56:17 1994
  266. --- dvi2xx.c    Sat Apr  2 13:48:34 1994
  267. ***************
  268. *** 132,139 ****
  269.   #define  NEW(A) ((A *)  malloc(sizeof(A)))
  270.   #define  EQ(a,b)        (strcmp(a,b)==0)
  271.   #define  MM_TO_PXL(x)   (int)(((x)*RESOLUTION*10)/254)
  272. ! #define  PT_TO_PXL(x)   (int)((long)((x)*RESOLUTION*100l)/7224)
  273. ! #define  PT_TO_DVI(x)   (long)((x)*65536l)
  274.   #define  BOPENCMD fopen
  275.   #define  BINOPEN(f) BOPENCMD(f,READ_BINARY)
  276.   /* SMALL_SIZE characters are loaded into font storage of the printer   */
  277. --- 132,139 ----
  278.   #define  NEW(A) ((A *)  malloc(sizeof(A)))
  279.   #define  EQ(a,b)        (strcmp(a,b)==0)
  280.   #define  MM_TO_PXL(x)   (int)(((x)*RESOLUTION*10)/254)
  281. ! #define  PT_TO_PXL(x)   (int)((long4)((x)*RESOLUTION*100l)/7224)
  282. ! #define  PT_TO_DVI(x)   (long4)((x)*65536l)
  283.   #define  BOPENCMD fopen
  284.   #define  BINOPEN(f) BOPENCMD(f,READ_BINARY)
  285.   /* SMALL_SIZE characters are loaded into font storage of the printer   */
  286. ***************
  287. *** 165,172 ****
  288.   #endif
  289.   #define  EMITWORD(w)    PUTWORD((w))         /* output a 2 byte word of data */
  290.   
  291. ! #define  MoveOver(b)  h += (long) b
  292. ! #define  MoveDown(a)  v += (long) a
  293.   #define  qfprintf if (!G_quiet) fprintf
  294.   #define  qprintf  if (!G_quiet) printf
  295.   #define  LARGER(a,b) (((a)>(b)) ? (a) : (b))
  296. --- 165,172 ----
  297.   #endif
  298.   #define  EMITWORD(w)    PUTWORD((w))         /* output a 2 byte word of data */
  299.   
  300. ! #define  MoveOver(b)  h += (long4) b
  301. ! #define  MoveDown(a)  v += (long4) a
  302.   #define  qfprintf if (!G_quiet) fprintf
  303.   #define  qprintf  if (!G_quiet) printf
  304.   #define  LARGER(a,b) (((a)>(b)) ? (a) : (b))
  305. ***************
  306. *** 174,180 ****
  307.   #ifdef IBM3812
  308.   #define  PRINTER      "IBM 3812 pageprinter"
  309.   #define  EMITC(c)      PMPoutC(c)               /* output a single character */
  310. ! #define  PMPcont(l)    PMPout(-1,(long)l)         /* next l bytes continuous */
  311.   #define  PMPflush      PMPout(0l,"")                     /* flush PMP-buffer */
  312.   #define  EMITL(l,d)    PMPout((int)l,d)      /* EMIT-logical: via PMP-buffer */
  313.   #define  hconvRESOLUTION   240
  314. --- 174,180 ----
  315.   #ifdef IBM3812
  316.   #define  PRINTER      "IBM 3812 pageprinter"
  317.   #define  EMITC(c)      PMPoutC(c)               /* output a single character */
  318. ! #define  PMPcont(l)    PMPout(-1,(char *)l)         /* next l bytes continuous */
  319.   #define  PMPflush      PMPout(0l,"")                     /* flush PMP-buffer */
  320.   #define  EMITL(l,d)    PMPout((int)l,d)      /* EMIT-logical: via PMP-buffer */
  321.   #define  hconvRESOLUTION   240
  322. ***************
  323. *** 234,241 ****
  324.   #define  MAXFONTSTORAGE (395l*1024l)                /* standard user memory */
  325.   #define  EMITC(c)       putc(c,outfp)          /* output a single character */
  326.   #define  EMITL(l,d)     EMITB(l,d)                  /* EMIT-logical = EMITB */
  327. ! #define  XDEFAULTOFF    RESOLUTION-54 /*x default offset on page 1 inch (LJ2)*/
  328. ! #define  YDEFAULTOFF    RESOLUTION+9    /* y default offset on page 1 inch */
  329.   #define  max(x,y)       if ((y)>(x)) x = y
  330.   #ifndef vms
  331.   #define  INT_ASCII(b,i) if (i == 0) b[0] = '\0'; else sprintf((char *)b,"%hd",i)
  332. --- 234,241 ----
  333.   #define  MAXFONTSTORAGE (395l*1024l)                /* standard user memory */
  334.   #define  EMITC(c)       putc(c,outfp)          /* output a single character */
  335.   #define  EMITL(l,d)     EMITB(l,d)                  /* EMIT-logical = EMITB */
  336. ! #define  XDEFAULTOFF    (RESOLUTION-54*RESOLUTION/300) /*x default offset on page 1 inch (LJ2)*/
  337. ! #define  YDEFAULTOFF    (RESOLUTION+9*RESOLUTION/300)    /* y default offset on page 1 inch */
  338.   #define  max(x,y)       if ((y)>(x)) x = y
  339.   #ifndef vms
  340.   #define  INT_ASCII(b,i) if (i == 0) b[0] = '\0'; else sprintf((char *)b,"%hd",i)
  341. ***************
  342. *** 303,309 ****
  343.   /* interface to gf.c */
  344.   extern FILE *gfin;
  345.   extern int checksum;
  346. ! extern long tfm_wd[], char_pointer[];
  347.   extern char char_exists[];
  348.   extern int num_cols, num_rows, num_bytes, x_offset, y_offset;
  349.   extern unsigned char bits[];
  350. --- 303,309 ----
  351.   /* interface to gf.c */
  352.   extern FILE *gfin;
  353.   extern int checksum;
  354. ! extern long4 tfm_wd[], char_pointer[];
  355.   extern char char_exists[];
  356.   extern int num_cols, num_rows, num_bytes, x_offset, y_offset;
  357.   extern unsigned char bits[];
  358. ***************
  359. *** 332,338 ****
  360.   void    CopyHPFile();
  361.   void    DecodeArgs();
  362.   void    DoBop();
  363. ! long    DoConv();
  364.   void    DoSpecial();
  365.   void    EmitChar();
  366.   void    Fatal();
  367. --- 332,338 ----
  368.   void    CopyHPFile();
  369.   void    DecodeArgs();
  370.   void    DoBop();
  371. ! long4    DoConv();
  372.   void    DoSpecial();
  373.   void    EmitChar();
  374.   void    Fatal();
  375. ***************
  376. *** 345,354 ****
  377.   bool    IsSame();
  378.   void    lcase();
  379.   void    LoadAChar();
  380. ! long    NoSignExtend();
  381.   /* see cautionary note in code, re arithmetic vs logical shifts */
  382.   void    OpenFontFile();
  383. ! long    PixRound();
  384.   void    PkRaster();
  385.   void    PutWord();
  386.   void    RasterLine();
  387. --- 345,354 ----
  388.   bool    IsSame();
  389.   void    lcase();
  390.   void    LoadAChar();
  391. ! long4    NoSignExtend();
  392.   /* see cautionary note in code, re arithmetic vs logical shifts */
  393.   void    OpenFontFile();
  394. ! long4    PixRound();
  395.   void    PkRaster();
  396.   void    PutWord();
  397.   void    RasterLine();
  398. ***************
  399. *** 360,366 ****
  400.   void    SetPosn();
  401.   void    SetRule();
  402.   void    SetString();
  403. ! long    SignExtend();
  404.   /* see cautionary note in code, re arithmetic vs logical shifts */
  405.   void    SkipFontDef();
  406.   void    Warning();
  407. --- 360,366 ----
  408.   void    SetPosn();
  409.   void    SetRule();
  410.   void    SetString();
  411. ! long4    SignExtend();
  412.   /* see cautionary note in code, re arithmetic vs logical shifts */
  413.   void    SkipFontDef();
  414.   void    Warning();
  415. ***************
  416. *** 383,408 ****
  417.       struct {
  418.           bool isloaded;
  419.           union {
  420. !             long    fileOffset;
  421. !             long    *pixptr;
  422.           } address;
  423.       } where;
  424. !     long    tfmw;             /* TFM width                 */
  425. !     long    cw;               /* character width in pixels */
  426.       unsigned char   flag_byte;          /* for PK-files    */
  427.       unsigned char   charsize;
  428.   };
  429.   struct font_entry {    /* font entry */
  430. !     long    k, c, s, d;
  431.       int     a, l;
  432.       char n[STRSIZE];          /* FNT_DEF command parameters                */
  433. !     long    font_mag;         /* computed from FNT_DEF s and d parameters  */
  434.       /*char psname[STRSIZE];*/ /* PostScript name of the font               */
  435.       char    name[STRSIZE];    /* full name of PXL file                     */
  436.       FILE * font_file_id;      /* file identifier (NO_FILE if none)         */
  437.   #ifdef USEPXL
  438. !     long    magnification;    /* magnification read from PXL file          */
  439. !     long    designsize;       /* design size read from PXL file            */
  440.   #endif
  441.       struct char_entry ch[NFNTCHARS];   /* character information            */
  442.       struct font_entry *next;
  443. --- 383,408 ----
  444.       struct {
  445.           bool isloaded;
  446.           union {
  447. !             long4    fileOffset;
  448. !             long4    *pixptr;
  449.           } address;
  450.       } where;
  451. !     long4    tfmw;             /* TFM width                 */
  452. !     long4    cw;               /* character width in pixels */
  453.       unsigned char   flag_byte;          /* for PK-files    */
  454.       unsigned char   charsize;
  455.   };
  456.   struct font_entry {    /* font entry */
  457. !     long4    k, c, s, d;
  458.       int     a, l;
  459.       char n[STRSIZE];          /* FNT_DEF command parameters                */
  460. !     long4    font_mag;         /* computed from FNT_DEF s and d parameters  */
  461.       /*char psname[STRSIZE];*/ /* PostScript name of the font               */
  462.       char    name[STRSIZE];    /* full name of PXL file                     */
  463.       FILE * font_file_id;      /* file identifier (NO_FILE if none)         */
  464.   #ifdef USEPXL
  465. !     long4    magnification;    /* magnification read from PXL file          */
  466. !     long4    designsize;       /* design size read from PXL file            */
  467.   #endif
  468.       struct char_entry ch[NFNTCHARS];   /* character information            */
  469.       struct font_entry *next;
  470. ***************
  471. *** 479,485 ****
  472.   #ifndef vms
  473.   short   G_errenc = 0;           /* has an error been encountered?      */
  474.   #else
  475. ! long    G_errenc = SS$_NORMAL;  /* has an error been encountered?      */
  476.   #endif
  477.   bool    G_header = FALSE;       /* copy header file to output?         */
  478.   bool    G_quiet = FALSE;        /* for quiet operation                 */
  479. --- 479,485 ----
  480.   #ifndef vms
  481.   short   G_errenc = 0;           /* has an error been encountered?      */
  482.   #else
  483. ! long4    G_errenc = SS$_NORMAL;  /* has an error been encountered?      */
  484.   #endif
  485.   bool    G_header = FALSE;       /* copy header file to output?         */
  486.   bool    G_quiet = FALSE;        /* for quiet operation                 */
  487. ***************
  488. *** 490,503 ****
  489.   short   x_goffset;              /* global x-offset in dots             */
  490.   short   y_goffset;              /* global y-offset in dots             */
  491.   unsigned short ncopies = 1;     /* number of copies to print           */
  492. ! long    hconv, vconv;           /* converts DVI units to pixels        */
  493. ! long    den;                    /* denominator specified in preamble   */
  494. ! long    num;                    /* numerator specified in preamble     */
  495. ! long    h;                      /* current horizontal position         */
  496. ! long    hh = 0;                 /* current h on device                 */
  497. ! long    v;                      /* current vertical position           */
  498. ! long    vv = 0;                 /* current v on device                 */
  499. ! long    mag;                    /* magnification specified in preamble */
  500.   long    usermag = 0;            /* user specified magnification        */
  501.   int     ndone = 0;              /* number of pages converted           */
  502.   int     nopen = 0;              /* number of open PXL files            */
  503. --- 490,503 ----
  504.   short   x_goffset;              /* global x-offset in dots             */
  505.   short   y_goffset;              /* global y-offset in dots             */
  506.   unsigned short ncopies = 1;     /* number of copies to print           */
  507. ! long4    hconv, vconv;           /* converts DVI units to pixels        */
  508. ! long4    den;                    /* denominator specified in preamble   */
  509. ! long4    num;                    /* numerator specified in preamble     */
  510. ! long4    h;                      /* current horizontal position         */
  511. ! long4    hh = 0;                 /* current h on device                 */
  512. ! long4    v;                      /* current vertical position           */
  513. ! long4    vv = 0;                 /* current v on device                 */
  514. ! long4    mag;                    /* magnification specified in preamble */
  515.   long    usermag = 0;            /* user specified magnification        */
  516.   int     ndone = 0;              /* number of pages converted           */
  517.   int     nopen = 0;              /* number of open PXL files            */
  518. ***************
  519. *** 512,531 ****
  520.   struct font_entry *hfontptr = NULL; /* font_entry pointer              */
  521.   struct font_entry *pfontptr = NULL; /* previous font_entry pointer     */
  522.   struct pixel_list pixel_files[MAXOPEN+1]; /* list of open PXL files    */
  523. ! long    postambleptr;           /* Pointer to the postamble            */
  524. ! long    ppagep;                 /* previous page pointer               */
  525.   static int      last_ry = UNKNOWN;      /* last y-position on page     */
  526.   static int      last_rx = UNKNOWN;      /* last x-position on page     */
  527. ! long   StartPrintPages;         /* notpad for double paged output      */
  528.   int    WouldPrint    = 0;
  529.   bool   ZeroPage = FALSE;        /* Document starts with a Zero Page    */
  530.   bool   EvenPage = FALSE;        /* Document starts with an even Page   */
  531. ! long   LastPtobePrinted = 0;
  532.   int    G_ncdl = 0;
  533.   
  534. ! long    allocated_storage = 0; /* size of mallocated storage (statistics) */
  535. ! long    power[32] ;
  536. ! long    gpower[33] ;
  537.   
  538.   
  539.   #ifdef DEBUG
  540. --- 512,531 ----
  541.   struct font_entry *hfontptr = NULL; /* font_entry pointer              */
  542.   struct font_entry *pfontptr = NULL; /* previous font_entry pointer     */
  543.   struct pixel_list pixel_files[MAXOPEN+1]; /* list of open PXL files    */
  544. ! long4    postambleptr;           /* Pointer to the postamble            */
  545. ! long4    ppagep;                 /* previous page pointer               */
  546.   static int      last_ry = UNKNOWN;      /* last y-position on page     */
  547.   static int      last_rx = UNKNOWN;      /* last x-position on page     */
  548. ! long4   StartPrintPages;         /* notpad for double paged output      */
  549.   int    WouldPrint    = 0;
  550.   bool   ZeroPage = FALSE;        /* Document starts with a Zero Page    */
  551.   bool   EvenPage = FALSE;        /* Document starts with an even Page   */
  552. ! long4   LastPtobePrinted = 0;
  553.   int    G_ncdl = 0;
  554.   
  555. ! long4    allocated_storage = 0; /* size of mallocated storage (statistics) */
  556. ! long4    power[32] ;
  557. ! long4    gpower[33] ;
  558.   
  559.   
  560.   #ifdef DEBUG
  561. ***************
  562. *** 541,547 ****
  563.   #endif
  564.   #endif
  565.   
  566. ! long     used_fontstorage = 0;
  567.   
  568.   #ifdef IBM3812
  569.   char    PMPformat[20];
  570. --- 541,547 ----
  571.   #endif
  572.   #endif
  573.   
  574. ! long4     used_fontstorage = 0;
  575.   
  576.   #ifdef IBM3812
  577.   char    PMPformat[20];
  578. ***************
  579. *** 583,593 ****
  580.   char    *argv[];
  581.   {
  582.       struct stack_entry {  /* stack entry */
  583. !         long    h, v, w, x, y, z;  /* what's on stack */
  584.       };
  585.       short   command;          /* current command                         */
  586. !     long    count[10];        /* the 10 counters at begining of each page*/
  587. !     long    cpagep = 0;       /* current page pointer                    */
  588.       bool Emitting = FALSE;    /* outputting typsetting instructions?     */
  589.       int     i;                /* command parameter; loop index           */
  590.       int     k;                /* temporary parameter                     */
  591. --- 583,593 ----
  592.   char    *argv[];
  593.   {
  594.       struct stack_entry {  /* stack entry */
  595. !         long4    h, v, w, x, y, z;  /* what's on stack */
  596.       };
  597.       short   command;          /* current command                         */
  598. !     long4    count[10];        /* the 10 counters at begining of each page*/
  599. !     long4    cpagep = 0;       /* current page pointer                    */
  600.       bool Emitting = FALSE;    /* outputting typsetting instructions?     */
  601.       int     i;                /* command parameter; loop index           */
  602.       int     k;                /* temporary parameter                     */
  603. ***************
  604. *** 597,607 ****
  605.       int     sp = 0;           /* stack pointer                           */
  606.       struct stack_entry stack[STACK_SIZE];  /* stack                      */
  607.       char    SpecialStr[STRSIZE]; /* "\special" strings                   */
  608. !     long    val, val2;        /* temporarys to hold command information  */
  609. !     long    w = 0;            /* current horizontal spacing              */
  610. !     long    x = 0;            /* current horizontal spacing              */
  611. !     long    y = 0;            /* current vertical spacing                */
  612. !     long    z = 0;            /* current vertical spacing                */
  613.   
  614.   
  615.   #ifdef vms
  616. --- 597,607 ----
  617.       int     sp = 0;           /* stack pointer                           */
  618.       struct stack_entry stack[STACK_SIZE];  /* stack                      */
  619.       char    SpecialStr[STRSIZE]; /* "\special" strings                   */
  620. !     long4    val, val2;        /* temporarys to hold command information  */
  621. !     long4    w = 0;            /* current horizontal spacing              */
  622. !     long4    x = 0;            /* current horizontal spacing              */
  623. !     long4    y = 0;            /* current vertical spacing                */
  624. !     long4    z = 0;            /* current vertical spacing                */
  625.   
  626.   
  627.   #ifdef vms
  628. ***************
  629. *** 695,701 ****
  630.   #ifdef LJ4
  631.       EMIT(outfp, "\033%%-12345X@PJL SET RESOLUTION=600\012");
  632.       EMIT(outfp, "@PJL SET PAGEPROTECT=OFF\012");
  633. !     EMIT(outfp, "@PJL SET ENTER LANGUAGE=PCL\012");
  634.       EMIT(outfp, "\033&u600D\033*t600R");
  635.       if (econoMode)
  636.         EMIT(outfp, "\033*v1T");
  637. --- 695,701 ----
  638.   #ifdef LJ4
  639.       EMIT(outfp, "\033%%-12345X@PJL SET RESOLUTION=600\012");
  640.       EMIT(outfp, "@PJL SET PAGEPROTECT=OFF\012");
  641. !     EMIT(outfp, "@PJL ENTER LANGUAGE=PCL\012");
  642.       EMIT(outfp, "\033&u600D\033*t600R");
  643.       if (econoMode)
  644.         EMIT(outfp, "\033*v1T");
  645. ***************
  646. *** 853,859 ****
  647.   */
  648.               if ( !SkipMode ) {
  649.                   if ( PassNo == 0)
  650. !                     qfprintf(stderr, "[%ld", count[0]);
  651.               }
  652.               break;
  653.           case EOP:
  654. --- 853,859 ----
  655.   */
  656.               if ( !SkipMode ) {
  657.                   if ( PassNo == 0)
  658. !                     qfprintf(stderr, "[%ld", (long)count[0]);
  659.               }
  660.               break;
  661.           case EOP:
  662. ***************
  663. *** 1024,1030 ****
  664.           default:
  665.               if (command >= FONT_00 && command <= FONT_63) {
  666.                   if (!SkipMode)
  667. !                     SetFntNum((long) command - FONT_00, Emitting);
  668.               } else if (command >= SETC_000 && command <= SETC_127) {
  669.                   if (!SkipMode) {
  670.                       SetString(command, PassNo);
  671. --- 1024,1030 ----
  672.           default:
  673.               if (command >= FONT_00 && command <= FONT_63) {
  674.                   if (!SkipMode)
  675. !                     SetFntNum((long4) command - FONT_00, Emitting);
  676.               } else if (command >= SETC_000 && command <= SETC_127) {
  677.                   if (!SkipMode) {
  678.                       SetString(command, PassNo);
  679. ***************
  680. *** 1043,1049 ****
  681.   /**********************************************************************/
  682.   double  /* compute the actual size factor given the approximation */
  683.   ActualFactor(unmodsize)
  684. ! long    unmodsize;                 /* actually factor * 1000 */
  685.   {
  686.       double  realsize;     /* the actual magnification factor */
  687.       realsize = (double)unmodsize / 1000.0;
  688. --- 1043,1049 ----
  689.   /**********************************************************************/
  690.   double  /* compute the actual size factor given the approximation */
  691.   ActualFactor(unmodsize)
  692. ! long4    unmodsize;                 /* actually factor * 1000 */
  693.   {
  694.       double  realsize;     /* the actual magnification factor */
  695.       realsize = (double)unmodsize / 1000.0;
  696. ***************
  697. *** 1154,1169 ****
  698.   
  699.       if (used_fontstorage > MAXFONTSTORAGE) {
  700.           Warning("\n\7used font_storage of %s: %ld Bytes (of %ld)\7",
  701. !             PRINTER, used_fontstorage, MAXFONTSTORAGE);
  702.           Warning("Try to format file in separate runs!");
  703.       } else
  704.           qfprintf(stderr,
  705.              "\nAll done, used font_storage of %s: %ld Bytes (of %ld)",
  706. !              PRINTER, used_fontstorage, MAXFONTSTORAGE);
  707.   #endif
  708.   #ifdef LJ
  709.       qfprintf(stderr, "\nAll done, used font_storage of %s: %ld Bytes",
  710. !              PRINTER, used_fontstorage);
  711.   #ifdef LJ_RESIDENT_FONTS
  712.       qfprintf(stderr, " + %d resident font%s", resident_count,
  713.                resident_count == 1 ? "" : "s");
  714. --- 1154,1169 ----
  715.   
  716.       if (used_fontstorage > MAXFONTSTORAGE) {
  717.           Warning("\n\7used font_storage of %s: %ld Bytes (of %ld)\7",
  718. !             PRINTER, (long)used_fontstorage, (long)MAXFONTSTORAGE);
  719.           Warning("Try to format file in separate runs!");
  720.       } else
  721.           qfprintf(stderr,
  722.              "\nAll done, used font_storage of %s: %ld Bytes (of %ld)",
  723. !              PRINTER, (long)used_fontstorage, (long)MAXFONTSTORAGE);
  724.   #endif
  725.   #ifdef LJ
  726.       qfprintf(stderr, "\nAll done, used font_storage of %s: %ld Bytes",
  727. !              PRINTER, (long)used_fontstorage);
  728.   #ifdef LJ_RESIDENT_FONTS
  729.       qfprintf(stderr, " + %d resident font%s", resident_count,
  730.                resident_count == 1 ? "" : "s");
  731. ***************
  732. *** 1182,1188 ****
  733.   
  734.       if (!G_quiet) {
  735.           fprintf(stderr,"\nDynamically allocated storage: %ld Bytes \n",
  736. !                     allocated_storage);
  737.           fprintf(stderr,"%d characters downloaded as soft fonts\n", G_ncdl);
  738.   
  739.   #ifdef TIMING
  740. --- 1182,1188 ----
  741.   
  742.       if (!G_quiet) {
  743.           fprintf(stderr,"\nDynamically allocated storage: %ld Bytes \n",
  744. !                     (long)allocated_storage);
  745.           fprintf(stderr,"%d characters downloaded as soft fonts\n", G_ncdl);
  746.   
  747.   #ifdef TIMING
  748. ***************
  749. *** 1877,1885 ****
  750.   /*********************************************************************/
  751.   /********************************  DoConv  ***************************/
  752.   /*********************************************************************/
  753. ! long
  754.   DoConv(num, den, convResolution)
  755. ! long    num, den;
  756.   int     convResolution;
  757.   {
  758.       /*register*/ double conv;
  759. --- 1877,1885 ----
  760.   /*********************************************************************/
  761.   /********************************  DoConv  ***************************/
  762.   /*********************************************************************/
  763. ! long4
  764.   DoConv(num, den, convResolution)
  765. ! long4    num, den;
  766.   int     convResolution;
  767.   {
  768.       /*register*/ double conv;
  769. ***************
  770. *** 1887,1893 ****
  771.               ((double)mag / 1000.0) *
  772.             ((double)convResolution/254000.0);
  773.   
  774. !     return((long) ((1.0/conv)+0.5));
  775.   }
  776.   
  777.   
  778. --- 1887,1893 ----
  779.               ((double)mag / 1000.0) *
  780.             ((double)convResolution/254000.0);
  781.   
  782. !     return((long4) ((1.0/conv)+0.5));
  783.   }
  784.   
  785.   
  786. ***************
  787. *** 1951,1962 ****
  788.     char    spbuf[STRSIZE], xs[STRSIZE], ys[STRSIZE];
  789.     char    *sf = NULL;
  790.     float   x,y;
  791. !   long     x_pos, y_pos;
  792.     KeyWord k;
  793.     int     i, j, j1;
  794.     static int   GrayScale=10, Pattern=1;
  795.     static bool  GrayFill=TRUE;
  796. !   static long  p_x[80], p_y[80];
  797.     str[n] = '\0';
  798.     spbuf[0] = '\0';
  799.   
  800. --- 1951,1962 ----
  801.     char    spbuf[STRSIZE], xs[STRSIZE], ys[STRSIZE];
  802.     char    *sf = NULL;
  803.     float   x,y;
  804. !   long4     x_pos, y_pos;
  805.     KeyWord k;
  806.     int     i, j, j1;
  807.     static int   GrayScale=10, Pattern=1;
  808.     static bool  GrayFill=TRUE;
  809. !   static long4  p_x[80], p_y[80];
  810.     str[n] = '\0';
  811.     spbuf[0] = '\0';
  812.   
  813. ***************
  814. *** 2039,2052 ****
  815.              if (i>1) {
  816.   #ifdef LJ
  817.                 SetPosn(p_x[j], p_y[j]);
  818. !               x_pos = (long)PIXROUND(p_x[j1]-p_x[j], hconv);
  819. !               y_pos = (long)PIXROUND(p_y[j1]-p_y[j], vconv);
  820.                 if (labs(x_pos)<labs(y_pos)) x_pos=x_pos+3;
  821.                 else                         y_pos=y_pos+3;
  822.                 if (GrayFill) {
  823. !         EMIT(outfp, "\033*c%lda%ldb%dg2P", x_pos, y_pos, GrayScale);
  824.                 } else {
  825. !         EMIT(outfp, "\033*c%lda%ldb%dg3P", x_pos, y_pos, Pattern);
  826.                 }
  827.                 last_ry = UNKNOWN;
  828.   #endif
  829. --- 2039,2052 ----
  830.              if (i>1) {
  831.   #ifdef LJ
  832.                 SetPosn(p_x[j], p_y[j]);
  833. !               x_pos = (long4)PIXROUND(p_x[j1]-p_x[j], hconv);
  834. !               y_pos = (long4)PIXROUND(p_y[j1]-p_y[j], vconv);
  835.                 if (labs(x_pos)<labs(y_pos)) x_pos=x_pos+3;
  836.                 else                         y_pos=y_pos+3;
  837.                 if (GrayFill) {
  838. !         EMIT(outfp, "\033*c%lda%ldb%dg2P", (long)x_pos, (long)y_pos, GrayScale);
  839.                 } else {
  840. !         EMIT(outfp, "\033*c%lda%ldb%dg3P", (long)x_pos, (long)y_pos, Pattern);
  841.                 }
  842.                 last_ry = UNKNOWN;
  843.   #endif
  844. ***************
  845. *** 2093,2105 ****
  846.   /**********************************************************************/
  847.   void                     /* output a character bitmap */
  848.   EmitChar(c, ce)
  849. ! long    c;
  850.   struct char_entry *ce;
  851.   {
  852.       register int    i;
  853.       register unsigned char  *sl;
  854.       unsigned short  nbpl, nwpl;
  855. !     long    total;
  856.   #ifdef LJ
  857.       unsigned char cnv_buffer[10];
  858.   #endif
  859. --- 2093,2105 ----
  860.   /**********************************************************************/
  861.   void                     /* output a character bitmap */
  862.   EmitChar(c, ce)
  863. ! long4    c;
  864.   struct char_entry *ce;
  865.   {
  866.       register int    i;
  867.       register unsigned char  *sl;
  868.       unsigned short  nbpl, nwpl;
  869. !     long4    total;
  870.   #ifdef LJ
  871.       unsigned char cnv_buffer[10];
  872.   #endif
  873. ***************
  874. *** 2168,2182 ****
  875.       if (fontptr->id == pk89)   {
  876.           nwpl = 0; /* initialize variable */
  877.           nbpl = ((int)(ce->width) +  7) >> 3;
  878. !         total = (long)ce->height * nbpl;
  879.       } else if (fontptr->id == id1002)   {
  880.           nwpl = 0; /* initialize variable */
  881.           nbpl = ((int)(ce->width) +  7) >> 3;
  882. !         total = (long)ce->height * nbpl;
  883.       } else if (fontptr->id == id1001) {
  884.           nwpl = ((int)(ce->width) + 31) >> 5;
  885.           nbpl = ((int)(ce->width) + 7) >> 3;
  886. !         total = (long)ce->height * nbpl;
  887.       } else {
  888.         /* should never be necessary */
  889.         nwpl = 0;
  890. --- 2168,2182 ----
  891.       if (fontptr->id == pk89)   {
  892.           nwpl = 0; /* initialize variable */
  893.           nbpl = ((int)(ce->width) +  7) >> 3;
  894. !         total = (long4)ce->height * nbpl;
  895.       } else if (fontptr->id == id1002)   {
  896.           nwpl = 0; /* initialize variable */
  897.           nbpl = ((int)(ce->width) +  7) >> 3;
  898. !         total = (long4)ce->height * nbpl;
  899.       } else if (fontptr->id == id1001) {
  900.           nwpl = ((int)(ce->width) + 31) >> 5;
  901.           nbpl = ((int)(ce->width) + 7) >> 3;
  902. !         total = (long4)ce->height * nbpl;
  903.       } else {
  904.         /* should never be necessary */
  905.         nwpl = 0;
  906. ***************
  907. *** 2189,2198 ****
  908.   #endif
  909.   /***************************************************************
  910.       if ( ((char) c == 'i') && (fontptr->plusid == 0)) {
  911. !         long j;
  912. !         fprintf(stderr, "cols=%ld, ncols=%ld\n",nwpl,nbpl);
  913.   
  914. !         fprintf(stderr, "%ld Bytes:->",total);
  915.           for (j=0; j<total;j++) {
  916.               char *ch; char ic;
  917.               ch = (char *)(ce->where.address.pixptr);
  918. --- 2189,2198 ----
  919.   #endif
  920.   /***************************************************************
  921.       if ( ((char) c == 'i') && (fontptr->plusid == 0)) {
  922. !         long4 j;
  923. !         fprintf(stderr, "cols=%ld, ncols=%ld\n",(long)nwpl,(long)nbpl);
  924.   
  925. !         fprintf(stderr, "%ld Bytes:->",(long)total);
  926.           for (j=0; j<total;j++) {
  927.               char *ch; char ic;
  928.               ch = (char *)(ce->where.address.pixptr);
  929. ***************
  930. *** 2216,2222 ****
  931.   #endif
  932.   #endif
  933.   
  934. !     /* ce->cw = (long)(((double)ce->tfmw / (double)hconv) +0.5); */
  935.       /* set active font to nn, load font pattern  xx ... */
  936.   #ifdef IBM3812
  937.       PMPcont(total + 9);
  938. --- 2216,2222 ----
  939.   #endif
  940.   #endif
  941.   
  942. !     /* ce->cw = (long4)(((double)ce->tfmw / (double)hconv) +0.5); */
  943.       /* set active font to nn, load font pattern  xx ... */
  944.   #ifdef IBM3812
  945.       PMPcont(total + 9);
  946. ***************
  947. *** 2285,2294 ****
  948.   #endif
  949.   #ifdef IBM3812
  950.   #ifdef USEPXL
  951. !     used_fontstorage += (long)ce->height * ((ce->width + 15) >> 4)
  952.           *2 + 14;
  953.   #else
  954. !     used_fontstorage += (long)num_rows * ((num_cols + 15) >> 4)
  955.           *2 + 14;
  956.   #endif
  957.   #endif
  958. --- 2285,2294 ----
  959.   #endif
  960.   #ifdef IBM3812
  961.   #ifdef USEPXL
  962. !     used_fontstorage += (long4)ce->height * ((ce->width + 15) >> 4)
  963.           *2 + 14;
  964.   #else
  965. !     used_fontstorage += (long4)num_rows * ((num_cols + 15) >> 4)
  966.           *2 + 14;
  967.   #endif
  968.   #endif
  969. ***************
  970. *** 2315,2321 ****
  971.   char    *buffer;
  972.   {
  973.   #ifdef IBM3812
  974. !     long    total;
  975.       static unsigned short   maxlines;
  976.   
  977.       if (current_line == 0) {
  978. --- 2315,2321 ----
  979.   char    *buffer;
  980.   {
  981.   #ifdef IBM3812
  982. !     long4    total;
  983.       static unsigned short   maxlines;
  984.   
  985.       if (current_line == 0) {
  986. ***************
  987. *** 2339,2351 ****
  988.               last_ry = UNKNOWN;    /* next time full positioning */
  989.           }
  990.   #ifdef USEPXL
  991. !         total = (long)(ce->height - current_line) * (long)nbpl;
  992.   #else
  993. !         total = (long)(num_rows - current_line) * (long)nbpl;
  994.   #endif
  995.           if ((total + 9) > 65535) {
  996.               maxlines = (unsigned short)((65535 - 9) / nbpl);
  997. !             total = (long)maxlines * (long)nbpl;
  998.           }
  999.   
  1000.           PMPcont(total + 9);
  1001. --- 2339,2351 ----
  1002.               last_ry = UNKNOWN;    /* next time full positioning */
  1003.           }
  1004.   #ifdef USEPXL
  1005. !         total = (long4)(ce->height - current_line) * (long4)nbpl;
  1006.   #else
  1007. !         total = (long4)(num_rows - current_line) * (long4)nbpl;
  1008.   #endif
  1009.           if ((total + 9) > 65535) {
  1010.               maxlines = (unsigned short)((65535 - 9) / nbpl);
  1011. !             total = (long4)maxlines * (long4)nbpl;
  1012.           }
  1013.   
  1014.           PMPcont(total + 9);
  1015. ***************
  1016. *** 2441,2448 ****
  1017.               RasterLine(ce, (unsigned int)nbpl, i, sl);
  1018.           }
  1019.       } else if (fontptr->id == id1001) {
  1020. !         long    filediff;
  1021. !         filediff = (long)nwpl * 4 - nbpl;
  1022.           for (i = 0; i < (int) ce->height; i++) {
  1023.               if (ce->charsize == HUGE_SIZE) {
  1024.                   fread(raster_line_buf, 1, (int) nbpl, pxlfp);
  1025. --- 2441,2448 ----
  1026.               RasterLine(ce, (unsigned int)nbpl, i, sl);
  1027.           }
  1028.       } else if (fontptr->id == id1001) {
  1029. !         long4    filediff;
  1030. !         filediff = (long4)nwpl * 4 - nbpl;
  1031.           for (i = 0; i < (int) ce->height; i++) {
  1032.               if (ce->charsize == HUGE_SIZE) {
  1033.                   fread(raster_line_buf, 1, (int) nbpl, pxlfp);
  1034. ***************
  1035. *** 2493,2503 ****
  1036.   /**********************************************************************/
  1037.   void
  1038.   FindPostAmblePtr(postambleptr)
  1039. ! long    *postambleptr;
  1040.   /* this routine will move to the end of the file and find the start
  1041.       of the postamble */
  1042.   {
  1043. !     long    i;
  1044.       fseek (dvifp,  0l, 2);   /* goto end of file */
  1045.       *postambleptr = ftell (dvifp) - 4;
  1046.       fseek (dvifp, *postambleptr, 0);
  1047. --- 2493,2503 ----
  1048.   /**********************************************************************/
  1049.   void
  1050.   FindPostAmblePtr(postambleptr)
  1051. ! long4    *postambleptr;
  1052.   /* this routine will move to the end of the file and find the start
  1053.       of the postamble */
  1054.   {
  1055. !     long4    i;
  1056.       fseek (dvifp,  0l, 2);   /* goto end of file */
  1057.       *postambleptr = ftell (dvifp) - 4;
  1058.       fseek (dvifp, *postambleptr, 0);
  1059. ***************
  1060. *** 2693,2704 ****
  1061.   /**********************************************************************/
  1062.   /***************************  NoSignExtend  ***************************/
  1063.   /**********************************************************************/
  1064. ! long
  1065.   NoSignExtend(fp, n)     /* return n byte quantity from file fd */
  1066.   register FILE *fp;      /* file pointer    */
  1067.   register int    n;      /* number of bytes */
  1068.   {
  1069. !     long    x;      /* number being constructed */
  1070.       x = 0;
  1071.       while (n--)  {
  1072.           x <<= 8;
  1073. --- 2693,2704 ----
  1074.   /**********************************************************************/
  1075.   /***************************  NoSignExtend  ***************************/
  1076.   /**********************************************************************/
  1077. ! long4
  1078.   NoSignExtend(fp, n)     /* return n byte quantity from file fd */
  1079.   register FILE *fp;      /* file pointer    */
  1080.   register int    n;      /* number of bytes */
  1081.   {
  1082. !     long4    x;      /* number being constructed */
  1083.       x = 0;
  1084.       while (n--)  {
  1085.           x <<= 8;
  1086. ***************
  1087. *** 2815,2824 ****
  1088.   /**********************************************************************/
  1089.   /*****************************  PixRound  *****************************/
  1090.   /**********************************************************************/
  1091. ! long
  1092.   PixRound(x, conv)       /* return rounded number of pixels */
  1093. ! long    x;          /* in DVI units     */
  1094. ! long    conv;       /* conversion factor */
  1095.   {
  1096.       return((x + conv) / conv);
  1097.   }
  1098. --- 2815,2824 ----
  1099.   /**********************************************************************/
  1100.   /*****************************  PixRound  *****************************/
  1101.   /**********************************************************************/
  1102. ! long4
  1103.   PixRound(x, conv)       /* return rounded number of pixels */
  1104. ! long4    x;          /* in DVI units     */
  1105. ! long4    conv;       /* conversion factor */
  1106.   {
  1107.       return((x + conv) / conv);
  1108.   }
  1109. ***************
  1110. *** 2888,2894 ****
  1111.   #endif
  1112.       for (i = 0; i < NFNTCHARS; i++) {
  1113.         struct char_entry *cptr = &(fontptr->ch[i]);
  1114. !       cptr->tfmw = (long) (tfm_info.widths[i] * factor);
  1115.         cptr->cw = ((fontptr->ch[i].tfmw) / (double) hconv) + .5;
  1116.         cptr->width = 
  1117.       cptr->height = 
  1118. --- 2888,2894 ----
  1119.   #endif
  1120.       for (i = 0; i < NFNTCHARS; i++) {
  1121.         struct char_entry *cptr = &(fontptr->ch[i]);
  1122. !       cptr->tfmw = (long4) (tfm_info.widths[i] * factor);
  1123.         cptr->cw = ((fontptr->ch[i].tfmw) / (double) hconv) + .5;
  1124.         cptr->width = 
  1125.       cptr->height = 
  1126. ***************
  1127. *** 2921,2929 ****
  1128.   /**********************************************************************/
  1129.   void
  1130.   ReadFontDef(k)
  1131. ! long    k;
  1132.   {
  1133. !     long    t;
  1134.       unsigned short i;
  1135.       struct font_entry *tfontptr; /* temporary font_entry pointer   */
  1136.       struct char_entry *tcharptr; /* temporary char_entry pointer  */
  1137. --- 2921,2929 ----
  1138.   /**********************************************************************/
  1139.   void
  1140.   ReadFontDef(k)
  1141. ! long4    k;
  1142.   {
  1143. !     long4    t;
  1144.       unsigned short i;
  1145.       struct font_entry *tfontptr; /* temporary font_entry pointer   */
  1146.       struct char_entry *tcharptr; /* temporary char_entry pointer  */
  1147. ***************
  1148. *** 2966,2973 ****
  1149.       GetBytes(dvifp, tfontptr->n, tfontptr->a + tfontptr->l);
  1150.       tfontptr->n[tfontptr->a+tfontptr->l] = '\0';
  1151.   
  1152. !     tfontptr->font_mag = (long)((
  1153. !          ActualFactor((long)(1000.0*tfontptr->s/(double)tfontptr->d+0.5))
  1154.            * ActualFactor(mag)
  1155.   #ifdef USEPXL
  1156.            * RESOLUTION * 5.0
  1157. --- 2966,2973 ----
  1158.       GetBytes(dvifp, tfontptr->n, tfontptr->a + tfontptr->l);
  1159.       tfontptr->n[tfontptr->a+tfontptr->l] = '\0';
  1160.   
  1161. !     tfontptr->font_mag = (long4)((
  1162. !          ActualFactor((long4)(1000.0*tfontptr->s/(double)tfontptr->d+0.5))
  1163.            * ActualFactor(mag)
  1164.   #ifdef USEPXL
  1165.            * RESOLUTION * 5.0
  1166. ***************
  1167. *** 2978,2987 ****
  1168.   /*
  1169.   printf("[%ld]=%lf * %lf * %lf + 0.5 = %ld\n",
  1170.       ((long)(1000.0*tfontptr->s/(double)tfontptr->d+0.5)),
  1171. !     ActualFactor((long)(1000.0*tfontptr->s/(double)tfontptr->d+0.5)),
  1172.       ActualFactor(mag),
  1173.       (double)RESOLUTION * 5,
  1174. !     tfontptr->font_mag );
  1175.   */
  1176.   
  1177.   #ifdef LJ_RESIDENT_FONTS
  1178. --- 2978,2987 ----
  1179.   /*
  1180.   printf("[%ld]=%lf * %lf * %lf + 0.5 = %ld\n",
  1181.       ((long)(1000.0*tfontptr->s/(double)tfontptr->d+0.5)),
  1182. !     ActualFactor((long4)(1000.0*tfontptr->s/(double)tfontptr->d+0.5)),
  1183.       ActualFactor(mag),
  1184.       (double)RESOLUTION * 5,
  1185. !     (long)tfontptr->font_mag );
  1186.   */
  1187.   
  1188.   #ifdef LJ_RESIDENT_FONTS
  1189. ***************
  1190. *** 2996,3004 ****
  1191.   #endif
  1192.   
  1193.       {
  1194.         kpse_font_file_type font_ret;
  1195.         unsigned dpi = tfontptr->font_mag / 5.0 + .5;
  1196. !       char *name = kpse_find_pk (tfontptr->n, dpi, &font_ret);
  1197.         if (name)
  1198.           {
  1199.             font_found = true;
  1200. --- 2996,3006 ----
  1201.   #endif
  1202.   
  1203.       {
  1204. +       char *name;
  1205.         kpse_font_file_type font_ret;
  1206.         unsigned dpi = tfontptr->font_mag / 5.0 + .5;
  1207. !       kpse_set_maketex_mag(dpi, (int) (RESOLUTION + .5));
  1208. !       name = kpse_find_pk (tfontptr->n, dpi, &font_ret);
  1209.         if (name)
  1210.           {
  1211.             font_found = true;
  1212. ***************
  1213. *** 3050,3056 ****
  1214.       plusid++;
  1215.   
  1216.       /* sprintf(tfontptr->psname,"%s.%ld.%d",
  1217. !        tfontptr->n,tfontptr->font_mag,tfontptr->plusid);*/
  1218.   
  1219.   #ifdef LJ
  1220.       if (plusid >= HANDLE_MAX_FONTS)
  1221. --- 3052,3058 ----
  1222.       plusid++;
  1223.   
  1224.       /* sprintf(tfontptr->psname,"%s.%ld.%d",
  1225. !        tfontptr->n,(long)tfontptr->font_mag,tfontptr->plusid);*/
  1226.   
  1227.   #ifdef LJ
  1228.       if (plusid >= HANDLE_MAX_FONTS)
  1229. ***************
  1230. *** 3082,3091 ****
  1231.   #ifdef USEPXL
  1232.           return;
  1233.       }
  1234. !     t = (long) NoSignExtend(pxlfp, 1);
  1235.       if (t == 0) {
  1236. !         t = (long) NoSignExtend(pxlfp, 1);
  1237. !         t = (long) NoSignExtend(pxlfp, 2);
  1238.           if (t == 1002)
  1239.               tfontptr->id = id1002;
  1240.           else if (t == 1001)
  1241. --- 3084,3093 ----
  1242.   #ifdef USEPXL
  1243.           return;
  1244.       }
  1245. !     t = (long4) NoSignExtend(pxlfp, 1);
  1246.       if (t == 0) {
  1247. !         t = (long4) NoSignExtend(pxlfp, 1);
  1248. !         t = (long4) NoSignExtend(pxlfp, 2);
  1249.           if (t == 1002)
  1250.               tfontptr->id = id1002;
  1251.           else if (t == 1001)
  1252. ***************
  1253. *** 3131,3140 ****
  1254.                   tcharptr->where.address.fileOffset = NoSignExtend(pxlfp,4) * 4;
  1255.               else
  1256.                   tcharptr->where.address.fileOffset = NoSignExtend(pxlfp,4);
  1257. !             tcharptr->tfmw = (long)
  1258.               (   (double)(NoSignExtend(pxlfp, 4))
  1259.                 * (double)tfontptr->s / (double) 0x100000 );
  1260. !             tcharptr->cw = (long)(((double)tcharptr->tfmw/(double)hconv) + 0.5);
  1261.   
  1262.               if (tcharptr->width  > CHAR_WIDTH_LARGE  ||
  1263.                   tcharptr->height > CHAR_HEIGTH_LARGE )
  1264. --- 3133,3142 ----
  1265.                   tcharptr->where.address.fileOffset = NoSignExtend(pxlfp,4) * 4;
  1266.               else
  1267.                   tcharptr->where.address.fileOffset = NoSignExtend(pxlfp,4);
  1268. !             tcharptr->tfmw = (long4)
  1269.               (   (double)(NoSignExtend(pxlfp, 4))
  1270.                 * (double)tfontptr->s / (double) 0x100000 );
  1271. !             tcharptr->cw = (long4)(((double)tcharptr->tfmw/(double)hconv) + 0.5);
  1272.   
  1273.               if (tcharptr->width  > CHAR_WIDTH_LARGE  ||
  1274.                   tcharptr->height > CHAR_HEIGTH_LARGE )
  1275. ***************
  1276. *** 3158,3164 ****
  1277.       } else { /* PK 89 format */
  1278.           unsigned char   temp_byte;
  1279.           register unsigned char  flag_byte;
  1280. !         long    hppp, vppp, pkloc, packet_length;
  1281.           int     car, ii;
  1282.   
  1283.           /* read comment */
  1284. --- 3160,3166 ----
  1285.       } else { /* PK 89 format */
  1286.           unsigned char   temp_byte;
  1287.           register unsigned char  flag_byte;
  1288. !         long4    hppp, vppp, pkloc, packet_length;
  1289.           int     car, ii;
  1290.   
  1291.           /* read comment */
  1292. ***************
  1293. *** 3183,3190 ****
  1294.           hppp = NoSignExtend(pxlfp, 4);
  1295.           vppp = NoSignExtend(pxlfp, 4);
  1296.           if (hppp != vppp)
  1297. !             Warning("aspect ratio is %ld:%ld (should be 1:1)!", hppp,vppp);
  1298. !         tfontptr->magnification = (long)(hppp * 72.27 * 5 / 65536l + 0.5);
  1299.   
  1300.           pkloc += 16;
  1301.           flag_byte = skip_specials(&pkloc);
  1302. --- 3185,3192 ----
  1303.           hppp = NoSignExtend(pxlfp, 4);
  1304.           vppp = NoSignExtend(pxlfp, 4);
  1305.           if (hppp != vppp)
  1306. !             Warning("aspect ratio is %ld:%ld (should be 1:1)!", (long)hppp,(long)vppp);
  1307. !         tfontptr->magnification = (long4)(hppp * 72.27 * 5 / 65536l + 0.5);
  1308.   
  1309.           pkloc += 16;
  1310.           flag_byte = skip_specials(&pkloc);
  1311. ***************
  1312. *** 3193,3199 ****
  1313.           if ((flag_byte & 7) == 7) {
  1314.           /* fprintf(stderr,"\nRead long character preamble\n"); */
  1315.   
  1316. !            packet_length = (unsigned long)NoSignExtend(pxlfp,4);
  1317.              if ((car = (int)NoSignExtend(pxlfp, 4)) > (LASTFNTCHAR))
  1318.                   Fatal("Bad character (%d) in PK-File\n",(int)car) ;
  1319.   
  1320. --- 3195,3201 ----
  1321.           if ((flag_byte & 7) == 7) {
  1322.           /* fprintf(stderr,"\nRead long character preamble\n"); */
  1323.   
  1324. !            packet_length = (unsigned long4)NoSignExtend(pxlfp,4);
  1325.              if ((car = (int)NoSignExtend(pxlfp, 4)) > (LASTFNTCHAR))
  1326.                   Fatal("Bad character (%d) in PK-File\n",(int)car) ;
  1327.   
  1328. ***************
  1329. *** 3202,3208 ****
  1330.              /* set pkloc to end_of_packet */
  1331.              pkloc += packet_length + 8;
  1332.   
  1333. !            tcharptr->tfmw = (long) NoSignExtend(pxlfp, 4);
  1334.              (void) NoSignExtend(pxlfp, 4); /* horesc not used */
  1335.              (void) NoSignExtend(pxlfp, 4); /* not used */
  1336.   
  1337. --- 3204,3210 ----
  1338.              /* set pkloc to end_of_packet */
  1339.              pkloc += packet_length + 8;
  1340.   
  1341. !            tcharptr->tfmw = (long4) NoSignExtend(pxlfp, 4);
  1342.              (void) NoSignExtend(pxlfp, 4); /* horesc not used */
  1343.              (void) NoSignExtend(pxlfp, 4); /* not used */
  1344.   
  1345. ***************
  1346. *** 3214,3220 ****
  1347.           } else if (flag_byte & 4) {
  1348.               /* fprintf(stderr,"Read extended short character preamble\n"); */
  1349.   
  1350. !             packet_length = ((long) flag_byte & 3) * 65536l +
  1351.                   (unsigned short) NoSignExtend(pxlfp, 2);
  1352.               if ((car = (int)NoSignExtend(pxlfp, 1)) > (LASTFNTCHAR))
  1353.                   Fatal("Bad character (%d) in PK-File\n",(int)car) ;
  1354. --- 3216,3222 ----
  1355.           } else if (flag_byte & 4) {
  1356.               /* fprintf(stderr,"Read extended short character preamble\n"); */
  1357.   
  1358. !             packet_length = ((long4) flag_byte & 3) * 65536l +
  1359.                   (unsigned short) NoSignExtend(pxlfp, 2);
  1360.               if ((car = (int)NoSignExtend(pxlfp, 1)) > (LASTFNTCHAR))
  1361.                   Fatal("Bad character (%d) in PK-File\n",(int)car) ;
  1362. ***************
  1363. *** 3224,3230 ****
  1364.               /* set pkloc to end_of_packet */
  1365.               pkloc += packet_length + 3;
  1366.   
  1367. !             tcharptr->tfmw = (long) NoSignExtend(pxlfp, 3);
  1368.   /*
  1369.               { register unsigned short t;
  1370.                 t = (unsigned short) NoSignExtend(pxlfp, 1);
  1371. --- 3226,3232 ----
  1372.               /* set pkloc to end_of_packet */
  1373.               pkloc += packet_length + 3;
  1374.   
  1375. !             tcharptr->tfmw = (long4) NoSignExtend(pxlfp, 3);
  1376.   /*
  1377.               { register unsigned short t;
  1378.                 t = (unsigned short) NoSignExtend(pxlfp, 1);
  1379. ***************
  1380. *** 3242,3248 ****
  1381.           } else {
  1382.               /* fprintf(stderr,"<Read short character preamble@>\n"); */
  1383.   
  1384. !             packet_length = ((long)flag_byte & 3) * 256 +
  1385.                   NoSignExtend(pxlfp, 1) ;
  1386.               if ((car = (int)NoSignExtend(pxlfp, 1)) > (LASTFNTCHAR))
  1387.                   Fatal("Bad character (%d) in PK-File\n",(int)car) ;
  1388. --- 3244,3250 ----
  1389.           } else {
  1390.               /* fprintf(stderr,"<Read short character preamble@>\n"); */
  1391.   
  1392. !             packet_length = ((long4)flag_byte & 3) * 256 +
  1393.                   NoSignExtend(pxlfp, 1) ;
  1394.               if ((car = (int)NoSignExtend(pxlfp, 1)) > (LASTFNTCHAR))
  1395.                   Fatal("Bad character (%d) in PK-File\n",(int)car) ;
  1396. ***************
  1397. *** 3252,3258 ****
  1398.               /* set pkloc to end_of_packet */
  1399.               pkloc += packet_length + 2 ;
  1400.   
  1401. !             tcharptr->tfmw = (long) NoSignExtend(pxlfp, 3);
  1402.   /*
  1403.               { register unsigned short t;
  1404.                 t = (unsigned short) NoSignExtend(pxlfp, 1);
  1405. --- 3254,3260 ----
  1406.               /* set pkloc to end_of_packet */
  1407.               pkloc += packet_length + 2 ;
  1408.   
  1409. !             tcharptr->tfmw = (long4) NoSignExtend(pxlfp, 3);
  1410.   /*
  1411.               { register unsigned short t;
  1412.                 t = (unsigned short) NoSignExtend(pxlfp, 1);
  1413. ***************
  1414. *** 3269,3278 ****
  1415.               tcharptr ->where.isloaded = FALSE;
  1416.           }
  1417.   
  1418. !         tcharptr->tfmw = (long)
  1419.              ( tcharptr->tfmw * (double)tfontptr->s / (double) 0x100000 );
  1420.   
  1421. !         tcharptr->cw = (long)(((double)tcharptr->tfmw /
  1422.               (double)hconv) + 0.5);
  1423.   
  1424.           if (tcharptr->width  > CHAR_WIDTH_LARGE  ||
  1425. --- 3271,3280 ----
  1426.               tcharptr ->where.isloaded = FALSE;
  1427.           }
  1428.   
  1429. !         tcharptr->tfmw = (long4)
  1430.              ( tcharptr->tfmw * (double)tfontptr->s / (double) 0x100000 );
  1431.   
  1432. !         tcharptr->cw = (long4)(((double)tcharptr->tfmw /
  1433.               (double)hconv) + 0.5);
  1434.   
  1435.           if (tcharptr->width  > CHAR_WIDTH_LARGE  ||
  1436. ***************
  1437. *** 3329,3336 ****
  1438.       for(i=FIRSTFNTCHAR; i<=LASTFNTCHAR; i++) {
  1439.       if (char_exists[i]) {
  1440.           tcharptr = &(tfontptr->ch[i]);
  1441. !         tcharptr->tfmw = (long)(((float)tfm_wd[i]*(float)tfontptr->s) /
  1442. !            (float)((long)1l<<20));
  1443.           tcharptr->where.address.fileOffset = char_pointer[i];
  1444.         }
  1445.   #ifdef LJ
  1446. --- 3331,3338 ----
  1447.       for(i=FIRSTFNTCHAR; i<=LASTFNTCHAR; i++) {
  1448.       if (char_exists[i]) {
  1449.           tcharptr = &(tfontptr->ch[i]);
  1450. !         tcharptr->tfmw = (long4)(((float)tfm_wd[i]*(float)tfontptr->s) /
  1451. !            (float)((long4)1l<<20));
  1452.           tcharptr->where.address.fileOffset = char_pointer[i];
  1453.         }
  1454.   #ifdef LJ
  1455. ***************
  1456. *** 3346,3352 ****
  1457.        fprintf(stderr,"%d:\t <%c> w=%d h=%d xO=%d yO=%d tfmw=%ld cw=%ld %d\n",       
  1458.        i,(char) i,                                                          
  1459.        tcharptr->width,tcharptr->height,tcharptr->xOffset,tcharptr->yOffset,
  1460. !      tcharptr->tfmw, tcharptr->cw, (int)(tcharptr->charsize));           
  1461.    */
  1462.   /*****************************************************************************/
  1463.       }
  1464. --- 3348,3354 ----
  1465.        fprintf(stderr,"%d:\t <%c> w=%d h=%d xO=%d yO=%d tfmw=%ld cw=%ld %d\n",       
  1466.        i,(char) i,                                                          
  1467.        tcharptr->width,tcharptr->height,tcharptr->xOffset,tcharptr->yOffset,
  1468. !      (long)tcharptr->tfmw, (long)tcharptr->cw, (int)(tcharptr->charsize));           
  1469.    */
  1470.   /*****************************************************************************/
  1471.       }
  1472. ***************
  1473. *** 3355,3368 ****
  1474.   
  1475.   unsigned char
  1476.   skip_specials( pkloc )
  1477. ! long    *pkloc;
  1478.   {
  1479. !     long    i, j;
  1480.       register unsigned char  flag_byte;
  1481.       do {
  1482.       flag_byte = (unsigned char) NoSignExtend(pxlfp, 1);
  1483.   /*
  1484. ! fprintf(stderr,"flagbyte = %d, pkloc=%ld\n",(int)flag_byte,*pkloc);
  1485.   */
  1486.   
  1487.       (*pkloc) ++;
  1488. --- 3357,3370 ----
  1489.   
  1490.   unsigned char
  1491.   skip_specials( pkloc )
  1492. ! long4    *pkloc;
  1493.   {
  1494. !     long4    i, j;
  1495.       register unsigned char  flag_byte;
  1496.       do {
  1497.       flag_byte = (unsigned char) NoSignExtend(pxlfp, 1);
  1498.   /*
  1499. ! fprintf(stderr,"flagbyte = %d, pkloc=%ld\n",(int)flag_byte,(long)*pkloc);
  1500.   */
  1501.   
  1502.       (*pkloc) ++;
  1503. ***************
  1504. *** 3373,3379 ****
  1505.           case 242:
  1506.           case 243 : {
  1507.               i = 0 ;
  1508. !             for (j = 240; j <= (long)flag_byte; j++) {
  1509.                   i = 256 * i + NoSignExtend(pxlfp, 1) ;
  1510.                   (*pkloc) ++;
  1511.               }
  1512. --- 3375,3381 ----
  1513.           case 242:
  1514.           case 243 : {
  1515.               i = 0 ;
  1516. !             for (j = 240; j <= (long4)flag_byte; j++) {
  1517.                   i = 256 * i + NoSignExtend(pxlfp, 1) ;
  1518.                   (*pkloc) ++;
  1519.               }
  1520. ***************
  1521. *** 3436,3442 ****
  1522.       mag = NoSignExtend(dvifp, 4);
  1523.       if ( usermag > 0 && usermag != mag )
  1524.           Warning("DVI magnification of %ld over-ridden by user (%ld)",
  1525. !                      mag, usermag );
  1526.       if ( usermag > 0 )
  1527.           mag = usermag;
  1528.       hconv = DoConv(num, den, hconvRESOLUTION);
  1529. --- 3438,3444 ----
  1530.       mag = NoSignExtend(dvifp, 4);
  1531.       if ( usermag > 0 && usermag != mag )
  1532.           Warning("DVI magnification of %ld over-ridden by user (%ld)",
  1533. !                      (long)mag, (long)usermag );
  1534.       if ( usermag > 0 )
  1535.           mag = usermag;
  1536.       hconv = DoConv(num, den, hconvRESOLUTION);
  1537. ***************
  1538. *** 3462,3472 ****
  1539.   /**********************************************************************/
  1540.   void
  1541.   LoadAChar(c, ptr)
  1542. ! long    c;
  1543.   register struct char_entry *ptr;
  1544.   {
  1545. !     long    *pr;
  1546. !     long    bytes;
  1547.   
  1548.       if (ptr->where.address.fileOffset == NONEXISTANT 
  1549.   #ifdef LJ_RESIDENT_FONTS
  1550. --- 3464,3474 ----
  1551.   /**********************************************************************/
  1552.   void
  1553.   LoadAChar(c, ptr)
  1554. ! long4    c;
  1555.   register struct char_entry *ptr;
  1556.   {
  1557. !     long4    *pr;
  1558. !     long4    bytes;
  1559.   
  1560.       if (ptr->where.address.fileOffset == NONEXISTANT 
  1561.   #ifdef LJ_RESIDENT_FONTS
  1562. ***************
  1563. *** 3482,3488 ****
  1564.   #ifdef DEBUG
  1565.       if (Debug)
  1566.         fprintf(stderr, "LoadAChar: <%c>(%ld) from file at pos %ld\n",
  1567. !           (char)c,c,ptr->where.address.fileOffset);
  1568.   #endif
  1569.   
  1570.   #ifdef USEPXL
  1571. --- 3484,3490 ----
  1572.   #ifdef DEBUG
  1573.       if (Debug)
  1574.         fprintf(stderr, "LoadAChar: <%c>(%ld) from file at pos %ld\n",
  1575. !           (char)c,(long)c,(long)ptr->where.address.fileOffset);
  1576.   #endif
  1577.   
  1578.   #ifdef USEPXL
  1579. ***************
  1580. *** 3502,3526 ****
  1581.   #endif
  1582.   
  1583.           if ((ptr->flag_byte & 7) == 7) {
  1584. !             bytes = ((long) NoSignExtend(pxlfp, 4)) - 28;
  1585.               fseek(pxlfp, ptr->where.address.fileOffset + 36, 0);
  1586.   /*
  1587. ! fprintf(stderr,"bytes=%d, seeking at %ld\n",
  1588. !             bytes, ptr->where.address.fileOffset + 36);
  1589.   */
  1590.           } else if ((ptr->flag_byte & 4) == 4) {
  1591. !             bytes = ((long)ptr->flag_byte & 3)
  1592.                   * 65536l + NoSignExtend(pxlfp, 2) - 13;
  1593.               fseek(pxlfp, ptr->where.address.fileOffset + 16, 0);
  1594.           } else {
  1595. !             bytes = ((long)ptr->flag_byte & 3)
  1596.                   * 256 + NoSignExtend(pxlfp, 1) - 8;
  1597.               fseek(pxlfp, ptr->where.address.fileOffset + 10, 0);
  1598.           }
  1599.       } else if (fontptr->id == id1002)
  1600. !         bytes =  ((( (long)ptr->width + 7) >> 3) * (long) ptr->height);
  1601.       else if (fontptr->id == id1001)
  1602. !         bytes =  4 * (((long)ptr->width + 31) >> 5) * (long)ptr->height;
  1603.       else 
  1604.           bytes = 0;
  1605.   
  1606. --- 3504,3528 ----
  1607.   #endif
  1608.   
  1609.           if ((ptr->flag_byte & 7) == 7) {
  1610. !             bytes = ((long4) NoSignExtend(pxlfp, 4)) - 28;
  1611.               fseek(pxlfp, ptr->where.address.fileOffset + 36, 0);
  1612.   /*
  1613. ! fprintf(stderr,"bytes=%ld, seeking at %ld\n",
  1614. !             (long)bytes, (long)ptr->where.address.fileOffset + 36);
  1615.   */
  1616.           } else if ((ptr->flag_byte & 4) == 4) {
  1617. !             bytes = ((long4)ptr->flag_byte & 3)
  1618.                   * 65536l + NoSignExtend(pxlfp, 2) - 13;
  1619.               fseek(pxlfp, ptr->where.address.fileOffset + 16, 0);
  1620.           } else {
  1621. !             bytes = ((long4)ptr->flag_byte & 3)
  1622.                   * 256 + NoSignExtend(pxlfp, 1) - 8;
  1623.               fseek(pxlfp, ptr->where.address.fileOffset + 10, 0);
  1624.           }
  1625.       } else if (fontptr->id == id1002)
  1626. !         bytes =  ((( (long4)ptr->width + 7) >> 3) * (long4) ptr->height);
  1627.       else if (fontptr->id == id1001)
  1628. !         bytes =  4 * (((long4)ptr->width + 31) >> 5) * (long4)ptr->height;
  1629.       else 
  1630.           bytes = 0;
  1631.   
  1632. ***************
  1633. *** 3527,3548 ****
  1634.       if (bytes > 0) {
  1635.                                             /* do NOT load Huge characters */
  1636.         if ((bytes > HUGE_CHAR_PATTERN) && (fontptr->id != pk89)) {
  1637. !     qfprintf(stderr,"Huge Character <%c> (%ld Bytes)\n", (char)c, bytes);
  1638.           ptr->charsize = HUGE_SIZE;
  1639.           ptr->where.isloaded = FALSE;
  1640.         } else {
  1641. !         if ( (pr = (long *)malloc( bytes )) == NULL )
  1642.               Fatal("Unable to allocate %ld bytes for char <%c>\n",
  1643. !                          bytes, (char)c);
  1644.   /*
  1645.    * else fprintf(stderr,"allocating %ld bytes char <%c>(%d)\t at 0x%lx\n",
  1646. !  *                       bytes, (char)c,(int)c,pr);
  1647.    */ 
  1648.   #ifdef DEBUG
  1649.           if (Debug)
  1650.             fprintf(stderr,
  1651.              "Allocating Char <%c>, FileOffset=%lX, Bytes=%ld (%d) <%d>\n",
  1652. !               (char) c, ptr->where.address.fileOffset, bytes,
  1653.                 (int)bytes, (unsigned int)bytes);
  1654.   #endif
  1655.           allocated_storage += bytes;
  1656. --- 3529,3550 ----
  1657.       if (bytes > 0) {
  1658.                                             /* do NOT load Huge characters */
  1659.         if ((bytes > HUGE_CHAR_PATTERN) && (fontptr->id != pk89)) {
  1660. !     qfprintf(stderr,"Huge Character <%c> (%ld Bytes)\n", (char)c, (long)bytes);
  1661.           ptr->charsize = HUGE_SIZE;
  1662.           ptr->where.isloaded = FALSE;
  1663.         } else {
  1664. !         if ( (pr = (long4 *)malloc( bytes )) == NULL )
  1665.               Fatal("Unable to allocate %ld bytes for char <%c>\n",
  1666. !                          (long)bytes, (char)c);
  1667.   /*
  1668.    * else fprintf(stderr,"allocating %ld bytes char <%c>(%d)\t at 0x%lx\n",
  1669. !  *                       (long)bytes, (char)c,(int)c,(long)pr);
  1670.    */ 
  1671.   #ifdef DEBUG
  1672.           if (Debug)
  1673.             fprintf(stderr,
  1674.              "Allocating Char <%c>, FileOffset=%lX, Bytes=%ld (%d) <%d>\n",
  1675. !               (char) c, (long)ptr->where.address.fileOffset, (long)bytes,
  1676.                 (int)bytes, (unsigned int)bytes);
  1677.   #endif
  1678.           allocated_storage += bytes;
  1679. ***************
  1680. *** 3584,3590 ****
  1681.   /**********************************************************************/
  1682.   void
  1683.   SetChar(c, command, PassNo, do_posn,in_string)
  1684. ! long    c;
  1685.   short   command;
  1686.   int     PassNo;
  1687.   bool do_posn,in_string;
  1688. --- 3586,3592 ----
  1689.   /**********************************************************************/
  1690.   void
  1691.   SetChar(c, command, PassNo, do_posn,in_string)
  1692. ! long4    c;
  1693.   short   command;
  1694.   int     PassNo;
  1695.   bool do_posn,in_string;
  1696. ***************
  1697. *** 3610,3619 ****
  1698.   
  1699.   /*
  1700.   printf("(%d) hh=%ld (+%ld/+%ld), h=%ld, xh=%ld,xhh=%ld, [%ld|%ld] ->%d\n",
  1701. !     (int)do_posn,hh,(long)ptr->cw,(long)ptr->cw*(long)hconv,h,
  1702. !     PIXROUND(h, hconv),
  1703. !     PIXROUND(hh, hconv),
  1704. !     labs((hh-h)),hconv,(labs((hh-h))>hconv)
  1705.       );
  1706.   */
  1707.   
  1708. --- 3612,3621 ----
  1709.   
  1710.   /*
  1711.   printf("(%d) hh=%ld (+%ld/+%ld), h=%ld, xh=%ld,xhh=%ld, [%ld|%ld] ->%d\n",
  1712. !     (int)do_posn,(long)hh,(long)ptr->cw,(long)ptr->cw*(long)hconv,(long)h,
  1713. !     (long)PIXROUND(h, hconv),
  1714. !     (long)PIXROUND(hh, hconv),
  1715. !     (long)labs((hh-h)),(long)hconv,(labs((hh-h))>hconv)
  1716.       );
  1717.   */
  1718.   
  1719. ***************
  1720. *** 3735,3741 ****
  1721.                  { TRANSPARENTCHAR(cc);}
  1722.   #endif
  1723.         }
  1724. !         hh += (long) ptr->cw*hconv;
  1725.       }
  1726.       if (command <= SET4)
  1727.           h += ptr->tfmw;
  1728. --- 3737,3743 ----
  1729.                  { TRANSPARENTCHAR(cc);}
  1730.   #endif
  1731.         }
  1732. !         hh += (long4) ptr->cw*hconv;
  1733.       }
  1734.       if (command <= SET4)
  1735.           h += ptr->tfmw;
  1736. ***************
  1737. *** 3769,3775 ****
  1738.   /**********************************************************************/
  1739.   void
  1740.   SetFntNum(k, Emitting)
  1741. ! long    k;
  1742.   bool Emitting;
  1743.   /*  this routine is used to specify the font to be used in printing future
  1744.       characters */
  1745. --- 3771,3777 ----
  1746.   /**********************************************************************/
  1747.   void
  1748.   SetFntNum(k, Emitting)
  1749. ! long4    k;
  1750.   bool Emitting;
  1751.   /*  this routine is used to specify the font to be used in printing future
  1752.       characters */
  1753. ***************
  1754. *** 3781,3787 ****
  1755.       while ((fontptr != NULL) && (fontptr->k != k))
  1756.           fontptr = fontptr->next;
  1757.       if (fontptr == NULL)
  1758. !         Fatal("font %ld undefined", k);
  1759.       if (Emitting && fontptr->font_file_id != NO_FILE) {
  1760.           if (!fontptr->used_on_this_page
  1761.   #ifdef LJ_RESIDENT_FONTS
  1762. --- 3783,3789 ----
  1763.       while ((fontptr != NULL) && (fontptr->k != k))
  1764.           fontptr = fontptr->next;
  1765.       if (fontptr == NULL)
  1766. !         Fatal("font %ld undefined", (long)k);
  1767.       if (Emitting && fontptr->font_file_id != NO_FILE) {
  1768.           if (!fontptr->used_on_this_page
  1769.   #ifdef LJ_RESIDENT_FONTS
  1770. ***************
  1771. *** 3862,3868 ****
  1772.   /**********************************************************************/
  1773.   void                  /* output a positioning command */
  1774.   SetPosn(x, y)
  1775. ! long    x, y;
  1776.   {
  1777.       int     rx, ry;
  1778.       rx = (int)PIXROUND(x, hconv) + x_goffset;
  1779. --- 3864,3870 ----
  1780.   /**********************************************************************/
  1781.   void                  /* output a positioning command */
  1782.   SetPosn(x, y)
  1783. ! long4    x, y;
  1784.   {
  1785.       int     rx, ry;
  1786.       rx = (int)PIXROUND(x, hconv) + x_goffset;
  1787. ***************
  1788. *** 3869,3875 ****
  1789.       ry = (int)PIXROUND(y, vconv) + y_goffset;
  1790.   
  1791.   /*
  1792. ! * fprintf(stderr,"setposn to %ld/%ld, %d/%d\n",x,y,rx,ry);
  1793.   */
  1794.   
  1795.   #ifdef IBM3812
  1796. --- 3871,3877 ----
  1797.       ry = (int)PIXROUND(y, vconv) + y_goffset;
  1798.   
  1799.   /*
  1800. ! * fprintf(stderr,"setposn to %ld/%ld, %d/%d\n",(long)x,(long)y,rx,ry);
  1801.   */
  1802.   
  1803.   #ifdef IBM3812
  1804. ***************
  1805. *** 3902,3908 ****
  1806.       vv = y;
  1807.   /*
  1808.    *     fprintf(stderr,"DoPosn: x=%ld, y=%ld, rx=%d, ry=%d, hh=%ld, vv=%ld\n",
  1809. !  *               x,y,rx,ry,hh,vv);
  1810.    */
  1811.   }
  1812.   
  1813. --- 3904,3910 ----
  1814.       vv = y;
  1815.   /*
  1816.    *     fprintf(stderr,"DoPosn: x=%ld, y=%ld, rx=%d, ry=%d, hh=%ld, vv=%ld\n",
  1817. !  *               (long)x,(long)y,rx,ry,(long)hh,(long)vv);
  1818.    */
  1819.   }
  1820.   
  1821. ***************
  1822. *** 3962,3982 ****
  1823.   /**********************************************************************/
  1824.   void                   /*   this routine will draw a rule */
  1825.   SetRule(a, b, Set)
  1826. ! long    a, b;
  1827.   int     Set;
  1828.   {
  1829. !     long    xx, yy;
  1830.   #ifdef IBM3812
  1831.       short   hor_offset, vert_offset, ll;
  1832.   #endif
  1833.       if ( a > 0 && b > 0 ) {
  1834.           SetPosn(h, v);             /* lower left corner */
  1835. !         xx = (long)PIXROUND(b, hconv);     /* width */
  1836. !         yy = (long)PIXROUND(a, vconv);     /* height */
  1837.   
  1838.   #ifdef DEBUG
  1839.           if (Debug)
  1840. !             fprintf(stderr,"Rule xx=%ld, yy=%ld\n", xx, yy);
  1841.   #endif
  1842.   
  1843.   #ifdef IBM3812
  1844. --- 3964,3984 ----
  1845.   /**********************************************************************/
  1846.   void                   /*   this routine will draw a rule */
  1847.   SetRule(a, b, Set)
  1848. ! long4    a, b;
  1849.   int     Set;
  1850.   {
  1851. !     long4    xx, yy;
  1852.   #ifdef IBM3812
  1853.       short   hor_offset, vert_offset, ll;
  1854.   #endif
  1855.       if ( a > 0 && b > 0 ) {
  1856.           SetPosn(h, v);             /* lower left corner */
  1857. !         xx = (long4)PIXROUND(b, hconv);     /* width */
  1858. !         yy = (long4)PIXROUND(a, vconv);     /* height */
  1859.   
  1860.   #ifdef DEBUG
  1861.           if (Debug)
  1862. !             fprintf(stderr,"Rule xx=%ld, yy=%ld\n", (long)xx, (long)yy);
  1863.   #endif
  1864.   
  1865.   #ifdef IBM3812
  1866. ***************
  1867. *** 4058,4064 ****
  1868.               hor_offset  = -(ll + hor_offset);
  1869.               vert_offset = (y0 - vert_offset);
  1870.   
  1871. !             yy -= (long)y0;
  1872.               hor_offset  += HOR_HALF(yy);
  1873.               MoveHor(hor_offset);
  1874.               vert_offset += VERT_HALF(yy);
  1875. --- 4060,4066 ----
  1876.               hor_offset  = -(ll + hor_offset);
  1877.               vert_offset = (y0 - vert_offset);
  1878.   
  1879. !             yy -= (long4)y0;
  1880.               hor_offset  += HOR_HALF(yy);
  1881.               MoveHor(hor_offset);
  1882.               vert_offset += VERT_HALF(yy);
  1883. ***************
  1884. *** 4072,4081 ****
  1885.       if (last_rx < 0) xx += last_rx;
  1886.   
  1887.       if (((int)pgsiz_dots >0) && ((int)last_ry > (int)pgsiz_dots))
  1888. !       yy += (long)pgsiz_dots - (long)last_ry;
  1889.   
  1890.           if ((yy>0) && (xx>0))
  1891. !                 EMIT(outfp, "\033*p-%ldY\033*c%lda%ldbP", yy - 1, xx, yy);
  1892.   #endif
  1893.           last_ry = UNKNOWN;       /* next time full positioning */
  1894.       }
  1895. --- 4074,4083 ----
  1896.       if (last_rx < 0) xx += last_rx;
  1897.   
  1898.       if (((int)pgsiz_dots >0) && ((int)last_ry > (int)pgsiz_dots))
  1899. !       yy += (long4)pgsiz_dots - (long4)last_ry;
  1900.   
  1901.           if ((yy>0) && (xx>0))
  1902. !                 EMIT(outfp, "\033*p-%ldY\033*c%lda%ldbP", (long)yy - 1, (long)xx, (long)yy);
  1903.   #endif
  1904.           last_ry = UNKNOWN;       /* next time full positioning */
  1905.       }
  1906. ***************
  1907. *** 4105,4111 ****
  1908.           if (Debug)
  1909.             fprintf(stderr, "%d(%c) ", c, c);
  1910.   #endif
  1911. !         SetChar((long)c,  c, PassNo, (bool)(i==0),TRUE);
  1912.           c = (short) NoSignExtend(dvifp, 1);
  1913.       }
  1914.       fseek(dvifp, -1l, 1);    /* backup one character */
  1915. --- 4107,4113 ----
  1916.           if (Debug)
  1917.             fprintf(stderr, "%d(%c) ", c, c);
  1918.   #endif
  1919. !         SetChar((long4)c,  c, PassNo, (bool)(i==0),TRUE);
  1920.           c = (short) NoSignExtend(dvifp, 1);
  1921.       }
  1922.       fseek(dvifp, -1l, 1);    /* backup one character */
  1923. ***************
  1924. *** 4119,4126 ****
  1925.   }
  1926.   
  1927.   #ifndef ARITHMETIC_RIGHT_SHIFT
  1928. ! long   signTab[5] = {0,0x00000080,0x00008000,0x00800000,0x00000000};
  1929. ! long extendTab[5] = {0,~0^0xff,~0^0xffff,~0^0xffffff,~0^0xffffffff};
  1930.   #endif
  1931.   
  1932.   /*-->SignExtend*/
  1933. --- 4121,4128 ----
  1934.   }
  1935.   
  1936.   #ifndef ARITHMETIC_RIGHT_SHIFT
  1937. ! long4   signTab[5] = {0,0x00000080,0x00008000,0x00800000,0x00000000};
  1938. ! long4 extendTab[5] = {0,~0^0xff,~0^0xffff,~0^0xffffff,~0^0xffffffff};
  1939.   #endif
  1940.   
  1941.   /*-->SignExtend*/
  1942. ***************
  1943. *** 4127,4141 ****
  1944.   /**********************************************************************/
  1945.   /****************************  SignExtend  ****************************/
  1946.   /**********************************************************************/
  1947. ! long
  1948.   SignExtend(fp, n)   /* return n byte quantity from file fd */
  1949.   register FILE *fp;  /* file pointer    */
  1950.   register int    n;  /* number of bytes */
  1951.   {
  1952.       int     n1;     /* number of bytes      */
  1953. !     long    x;      /* number being constructed */
  1954.   #ifdef SIGN_DEBUG
  1955. !     long    x0;     /* copy of x  */
  1956.   #endif
  1957.       x = getc(fp);   /* get first (high-order) byte */
  1958.       n1 = n--;
  1959. --- 4129,4143 ----
  1960.   /**********************************************************************/
  1961.   /****************************  SignExtend  ****************************/
  1962.   /**********************************************************************/
  1963. ! long4
  1964.   SignExtend(fp, n)   /* return n byte quantity from file fd */
  1965.   register FILE *fp;  /* file pointer    */
  1966.   register int    n;  /* number of bytes */
  1967.   {
  1968.       int     n1;     /* number of bytes      */
  1969. !     long4    x;      /* number being constructed */
  1970.   #ifdef SIGN_DEBUG
  1971. !     long4    x0;     /* copy of x  */
  1972.   #endif
  1973.       x = getc(fp);   /* get first (high-order) byte */
  1974.       n1 = n--;
  1975. ***************
  1976. *** 4250,4256 ****
  1977.   {
  1978.       static char     buffer[OUTBUFSIZE];
  1979.       static unsigned short   bp = 0;         /* range 0..OUTBUFSIZE */
  1980. !     static long     continuous = 0l;
  1981.       static bool buffered = TRUE;
  1982.   
  1983.       if (l == 0) {
  1984. --- 4252,4258 ----
  1985.   {
  1986.       static char     buffer[OUTBUFSIZE];
  1987.       static unsigned short   bp = 0;         /* range 0..OUTBUFSIZE */
  1988. !     static long4     continuous = 0l;
  1989.       static bool buffered = TRUE;
  1990.   
  1991.       if (l == 0) {
  1992. ***************
  1993. *** 4263,4272 ****
  1994.           return;
  1995.       }
  1996.       if (l == -1) {
  1997. !         continuous = (long)s;
  1998. !         if (continuous + (long)bp + 5l > (long) OUTBUFSIZE)
  1999.               PMPflush;
  2000. !         buffered = (bool) ((continuous + 5l <= (long) OUTBUFSIZE));
  2001.           if (!buffered) {
  2002.               EMIT(outfp, "\033[C%c%c",
  2003.                   (unsigned char)(continuous & 0xFF),
  2004. --- 4265,4274 ----
  2005.           return;
  2006.       }
  2007.       if (l == -1) {
  2008. !         continuous = (long4)s;
  2009. !         if (continuous + (long4)bp + 5l > (long4) OUTBUFSIZE)
  2010.               PMPflush;
  2011. !         buffered = (bool) ((continuous + 5l <= (long4) OUTBUFSIZE));
  2012.           if (!buffered) {
  2013.               EMIT(outfp, "\033[C%c%c",
  2014.                   (unsigned char)(continuous & 0xFF),
  2015. ***************
  2016. *** 4276,4282 ****
  2017.       }
  2018.       if (buffered) {
  2019.           register int    i;
  2020. !         if ( ((long)l + bp) > OUTBUFSIZE)
  2021.               PMPflush;
  2022.           for (i = 0; i < l; i++)
  2023.               buffer[bp+i] = s[i];
  2024. --- 4278,4284 ----
  2025.       }
  2026.       if (buffered) {
  2027.           register int    i;
  2028. !         if ( ((long4)l + bp) > OUTBUFSIZE)
  2029.               PMPflush;
  2030.           for (i = 0; i < l; i++)
  2031.               buffer[bp+i] = s[i];
  2032. ***************
  2033. *** 4283,4289 ****
  2034.           bp += (unsigned short)l;
  2035.       } else {
  2036.           EMITB((int)l, s);
  2037. !         buffered = (bool) ((continuous -= (long)l) <= 0) ;
  2038.       }
  2039.   }
  2040.   
  2041. --- 4285,4291 ----
  2042.           bp += (unsigned short)l;
  2043.       } else {
  2044.           EMITB((int)l, s);
  2045. !         buffered = (bool) ((continuous -= (long4)l) <= 0) ;
  2046.       }
  2047.   }
  2048.   
  2049. ***************
  2050. *** 4340,4346 ****
  2051.   #ifdef USEPXL
  2052.   bool getbit ();
  2053.   unsigned char   getnyb ();
  2054. ! long    pk_packed_num ();
  2055.   
  2056.   
  2057.   #define  PKBYTE   *pkloc; pkloc ++
  2058. --- 4342,4348 ----
  2059.   #ifdef USEPXL
  2060.   bool getbit ();
  2061.   unsigned char   getnyb ();
  2062. ! long4    pk_packed_num ();
  2063.   
  2064.   
  2065.   #define  PKBYTE   *pkloc; pkloc ++
  2066. ***************
  2067. *** 4361,4368 ****
  2068.       int     wordwidth ;
  2069.       bool turnon;
  2070.       unsigned short  nbpl;
  2071. !     long    rowsleft, word, wordweight, hbit, count, i, j, tl;
  2072. !     long    row[101] ;
  2073.       unsigned char   raster_line_buf[BYTES_PER_PIXEL_LINE];
  2074.       unsigned short  bp;
  2075.   
  2076. --- 4363,4370 ----
  2077.       int     wordwidth ;
  2078.       bool turnon;
  2079.       unsigned short  nbpl;
  2080. !     long4    rowsleft, word, wordweight, hbit, count, i, j, tl;
  2081. !     long4    row[101] ;
  2082.       unsigned char   raster_line_buf[BYTES_PER_PIXEL_LINE];
  2083.       unsigned short  bp;
  2084.   
  2085. ***************
  2086. *** 4381,4387 ****
  2087.       bitweight = 0 ;
  2088.       if (dyn_f == 14) {
  2089.           /*printf("<Get raster by bits@>\n");*/
  2090. !         for (i = 1; i <= (long)ce->height; i++) {
  2091.           word = 0 ;
  2092.           wordweight = 31 ;
  2093.           bp = 0;            /* Sowa */
  2094. --- 4383,4389 ----
  2095.       bitweight = 0 ;
  2096.       if (dyn_f == 14) {
  2097.           /*printf("<Get raster by bits@>\n");*/
  2098. !         for (i = 1; i <= (long4)ce->height; i++) {
  2099.           word = 0 ;
  2100.           wordweight = 31 ;
  2101.           bp = 0;            /* Sowa */
  2102. ***************
  2103. *** 4389,4395 ****
  2104.   #ifdef DRAWGLYPH
  2105.              printf("     |");
  2106.   #endif
  2107. !         for (j = 1; j <= (long) ce->width; j++) {
  2108.               bool getbit;
  2109.               /* bp = 0;               SOWA */
  2110.   /*******************************************begin Getbit *********/
  2111. --- 4391,4397 ----
  2112.   #ifdef DRAWGLYPH
  2113.              printf("     |");
  2114.   #endif
  2115. !         for (j = 1; j <= (long4) ce->width; j++) {
  2116.               bool getbit;
  2117.               /* bp = 0;               SOWA */
  2118.   /*******************************************begin Getbit *********/
  2119. ***************
  2120. *** 4441,4447 ****
  2121.   #endif
  2122.   #endif
  2123.   
  2124. !             for (j = 3; j >= (wordwidth * 4 - (long)nbpl);
  2125.               j--) {
  2126.   
  2127.                   OUTCHAR(((word >> (j << 3)) & 0xff));
  2128. --- 4443,4449 ----
  2129.   #endif
  2130.   #endif
  2131.   
  2132. !             for (j = 3; j >= (wordwidth * 4 - (long4)nbpl);
  2133.               j--) {
  2134.   
  2135.                   OUTCHAR(((word >> (j << 3)) & 0xff));
  2136. ***************
  2137. *** 4471,4478 ****
  2138.           }
  2139.       } else {
  2140.           /* fprintf(stderr, "@<Create normally packed raster@>\n"); */
  2141. !         rowsleft = (long) ce->height ;
  2142. !         hbit = (long) ce->width ;
  2143.           repeatcount = 0 ;
  2144.           wordweight = 32 ;
  2145.           word = 0 ;
  2146. --- 4473,4480 ----
  2147.           }
  2148.       } else {
  2149.           /* fprintf(stderr, "@<Create normally packed raster@>\n"); */
  2150. !         rowsleft = (long4) ce->height ;
  2151. !         hbit = (long4) ce->width ;
  2152.           repeatcount = 0 ;
  2153.           wordweight = 32 ;
  2154.           word = 0 ;
  2155. ***************
  2156. *** 4502,4508 ****
  2157.               row[rp] = word ;
  2158.   
  2159.               /*fprintf(stderr, " @<Send row@> \n");*/
  2160. !             for (i = 0; i <= (long) repeatcount; i++) { int ii;
  2161.   
  2162.   #ifdef DRAWGLYPH
  2163.     printf("***  |");
  2164. --- 4504,4510 ----
  2165.               row[rp] = word ;
  2166.   
  2167.               /*fprintf(stderr, " @<Send row@> \n");*/
  2168. !             for (i = 0; i <= (long4) repeatcount; i++) { int ii;
  2169.   
  2170.   #ifdef DRAWGLYPH
  2171.     printf("***  |");
  2172. ***************
  2173. *** 4525,4531 ****
  2174.   #endif
  2175.                   }
  2176.                   tl = row[wordwidth];
  2177. !                 for (j = 3; j >= (wordwidth *4 - (long)nbpl);
  2178.                    j--) {
  2179.   
  2180.                    OUTCHAR(((tl >> (j << 3)) & 0xff));
  2181. --- 4527,4533 ----
  2182.   #endif
  2183.                   }
  2184.                   tl = row[wordwidth];
  2185. !                 for (j = 3; j >= (wordwidth *4 - (long4)nbpl);
  2186.                    j--) {
  2187.   
  2188.                    OUTCHAR(((tl >> (j << 3)) & 0xff));
  2189. ***************
  2190. *** 4553,4570 ****
  2191.   
  2192.   #ifdef DRAWGLYPH
  2193.      printf("|  ");
  2194. !    for (j=1;j<=(long)wordwidth;j++) printf("%02lX/",row[j]);
  2195.      printf(" raster=%d\n",raster);
  2196.   #endif
  2197.               }
  2198.   
  2199. !             rowsleft -=  (long)repeatcount + 1 ;
  2200.               repeatcount = 0 ;
  2201.               rp = 1 ;
  2202.               word = 0 ;
  2203.               wordweight = 32 ;
  2204.               count -= hbit ;
  2205. !             hbit = (long)ce->width ;
  2206.               } else {
  2207.               if (turnon) word += gpower[wordweight] ;
  2208.               row[rp] = word ;
  2209. --- 4555,4572 ----
  2210.   
  2211.   #ifdef DRAWGLYPH
  2212.      printf("|  ");
  2213. !    for (j=1;j<=(long4)wordwidth;j++) printf("%02lX/",row[j]);
  2214.      printf(" raster=%d\n",raster);
  2215.   #endif
  2216.               }
  2217.   
  2218. !             rowsleft -=  (long4)repeatcount + 1 ;
  2219.               repeatcount = 0 ;
  2220.               rp = 1 ;
  2221.               word = 0 ;
  2222.               wordweight = 32 ;
  2223.               count -= hbit ;
  2224. !             hbit = (long4)ce->width ;
  2225.               } else {
  2226.               if (turnon) word += gpower[wordweight] ;
  2227.               row[rp] = word ;
  2228. ***************
  2229. *** 4580,4586 ****
  2230.           else
  2231.               turnon = TRUE;
  2232.           } /* ...... rowsleft > 0 */
  2233. !         if ((rowsleft != 0) || (hbit != (long)ce->width))
  2234.               Fatal("Bad pk file----more bits than required!\n");
  2235.       } /* .... create normally packed raster */
  2236.   }
  2237. --- 4582,4588 ----
  2238.           else
  2239.               turnon = TRUE;
  2240.           } /* ...... rowsleft > 0 */
  2241. !         if ((rowsleft != 0) || (hbit != (long4)ce->width))
  2242.               Fatal("Bad pk file----more bits than required!\n");
  2243.       } /* .... create normally packed raster */
  2244.   }
  2245. ***************
  2246. *** 4600,4626 ****
  2247.   }
  2248.   
  2249.   
  2250. ! long
  2251.   pk_packed_num ()
  2252.   { /*@<Packed number procedure@>= */
  2253.       register int    i;
  2254. !     long    j;
  2255.   
  2256.       i = (int)getnyb();
  2257.       if (i == 0) {
  2258.           do {
  2259. !             j = (long)getnyb();
  2260.               i++;
  2261.           } while (j == 0) ;
  2262.           while (i > 0) {
  2263. !             j = j * 16 + (long)getnyb() ;
  2264.               i--;
  2265.           };
  2266.           return (j - 15 + (13 - dyn_f) * 16 + dyn_f) ;
  2267.       } else if (i <= (int)dyn_f) {
  2268. !         return ((long)i);
  2269.       } else if (i < 14) {
  2270. !         return ((i-(long)dyn_f - 1) * 16 + (long)getnyb() + dyn_f + 1);
  2271.       } else {
  2272.           if (i == 14) {
  2273.               repeatcount = (int) pk_packed_num() ;
  2274. --- 4602,4628 ----
  2275.   }
  2276.   
  2277.   
  2278. ! long4
  2279.   pk_packed_num ()
  2280.   { /*@<Packed number procedure@>= */
  2281.       register int    i;
  2282. !     long4    j;
  2283.   
  2284.       i = (int)getnyb();
  2285.       if (i == 0) {
  2286.           do {
  2287. !             j = (long4)getnyb();
  2288.               i++;
  2289.           } while (j == 0) ;
  2290.           while (i > 0) {
  2291. !             j = j * 16 + (long4)getnyb() ;
  2292.               i--;
  2293.           };
  2294.           return (j - 15 + (13 - dyn_f) * 16 + dyn_f) ;
  2295.       } else if (i <= (int)dyn_f) {
  2296. !         return ((long4)i);
  2297.       } else if (i < 14) {
  2298. !         return ((i-(long4)dyn_f - 1) * 16 + (long4)getnyb() + dyn_f + 1);
  2299.       } else {
  2300.           if (i == 14) {
  2301.               repeatcount = (int) pk_packed_num() ;
  2302. *** dvilj.1.orig    Wed Mar  2 16:37:09 1994
  2303. --- dvilj.1    Fri Apr  1 18:02:36 1994
  2304. ***************
  2305. *** 1,8 ****
  2306.   .TH DVILJK 1 "2 March 1994"
  2307.   .ad b
  2308.   .SH NAME
  2309. ! dvilj2, dvilj2p, dvilj, dviljp, dvi3812 \- convert dvi files to HP
  2310. ! LaserJet or IBM 3812 format
  2311.   .SH SYNOPSIS
  2312.   \f3dvi2lj\f1 [\f3-a\f2fontpath\f1] 
  2313.   [\f3-b \f1] 
  2314. --- 1,8 ----
  2315.   .TH DVILJK 1 "2 March 1994"
  2316.   .ad b
  2317.   .SH NAME
  2318. ! dvilj4, dvilj2p, dvilj \- convert dvi files to HP
  2319. ! LaserJet format
  2320.   .SH SYNOPSIS
  2321.   \f3dvi2lj\f1 [\f3-a\f2fontpath\f1] 
  2322.   [\f3-b \f1] 
  2323. ***************
  2324. *** 31,37 ****
  2325.   [\f3-z\f1] 
  2326.   [\f2filename\f1]
  2327.   .SH DESCRIPTION
  2328. ! Dvilj2 converts TeX-output .dvi files into HP PCL (i.e. HP Printer 
  2329.   Control Language) commands suitable for printing on a HP LaserJet+,  
  2330.   HP LaserJet II and fully compatible printers.
  2331.   .br
  2332. --- 31,37 ----
  2333.   [\f3-z\f1] 
  2334.   [\f2filename\f1]
  2335.   .SH DESCRIPTION
  2336. ! Dvilj converts TeX-output .dvi files into HP PCL (i.e. HP Printer 
  2337.   Control Language) commands suitable for printing on a HP LaserJet+,  
  2338.   HP LaserJet II and fully compatible printers.
  2339.   .br
  2340. ***************
  2341. *** 40,49 ****
  2342.   and fully compatible printers. This version uses a newer PCL command
  2343.   set and provides landscape printing.
  2344.   .br
  2345. - Dviljp and dvilj are similar to dvilj2p and dvilj2 but they support
  2346. - only 128 character fonts. They may be used for Laserjet clones which do
  2347. - not support 256 character fonts.
  2348. - .br
  2349.   Dvilj4 is for the HP LasterJet IV printer familiy and fully compatible
  2350.   clones. It implements a superset of the commands available for dvilj2p
  2351.   and prints with an resolution of 600 dpi. In addition it provides support
  2352. --- 40,45 ----
  2353. ***************
  2354. *** 55,72 ****
  2355.   fonts that come with the distribution in the plain-compatible or
  2356.   Cork-compatible encodings).
  2357.   .br
  2358. - Dvi3812 converts TeX-output .dvi files into PMP files, 
  2359. - the native command language of the IBM 3812 page printer.
  2360. - .br
  2361.   All programs are generated from the same source dvi2xx.c.
  2362.   They are usually called by a shell script or as a line printer filter.
  2363.   
  2364.   .SH OPTIONS
  2365.   .TP
  2366. - \f3-b\f1
  2367. - .br
  2368. - take paper for first page from alternate cassette (only 3812)
  2369. - .TP
  2370.   \f3-c\f2number\f1 
  2371.   print each page \f2number\f1 times (including original)
  2372.   .TP
  2373. --- 51,61 ----
  2374. ***************
  2375. *** 86,93 ****
  2376.   Switch printer into econo mode (dvilj4 only)
  2377.   .TP
  2378.   \f3-e\f2output file\f1
  2379. ! default output filename is the basename of dvi file and extension '.lj' 
  2380. ! for laserjet and '.pmp' for 3812. The '-e' option can be used to override
  2381.   this default and to direct the output to a different file. 
  2382.   If the output filename is set to '-` (option '-e-') the output is directed 
  2383.   to stdout and can be directly piped into a spooler.
  2384. --- 75,82 ----
  2385.   Switch printer into econo mode (dvilj4 only)
  2386.   .TP
  2387.   \f3-e\f2output file\f1
  2388. ! default output filename is the basename of dvi file and extension '.lj'.
  2389. ! The '-e' option can be used to override
  2390.   this default and to direct the output to a different file. 
  2391.   If the output filename is set to '-` (option '-e-') the output is directed 
  2392.   to stdout and can be directly piped into a spooler.
  2393. ***************
  2394. *** 106,112 ****
  2395.   \f3-l\f1
  2396.   .br
  2397.   landscape - print output in landscape mode. This option is provided 
  2398. ! only for dvilj2p, dvilj4 and dvi3812.
  2399.   .TP
  2400.   \f3-M\f2flag\f1
  2401.   Do not call MakeTeXPK. \f3-M\f21\f1 and \f3-M\f1 are equivalent,
  2402. --- 95,101 ----
  2403.   \f3-l\f1
  2404.   .br
  2405.   landscape - print output in landscape mode. This option is provided 
  2406. ! only for dvilj2p and dvilj4.
  2407.   .TP
  2408.   \f3-M\f2flag\f1
  2409.   Do not call MakeTeXPK. \f3-M\f21\f1 and \f3-M\f1 are equivalent,
  2410. ***************
  2411. *** 145,154 ****
  2412.   \f3-r\f1   
  2413.   .br
  2414.   toggle reverse/not reverse order for output.
  2415. ! By default reverse=FALSE for 3812, reverse=TRUE for laserjet.
  2416.   .TP
  2417.   \f3-s\f2pagesize \f1
  2418. ! Spezify pagesize (LJ-family only!)
  2419.   .br
  2420.   \f3-s1\f1:  executive         (7.25in * 10.5in)
  2421.   .br
  2422. --- 134,143 ----
  2423.   \f3-r\f1   
  2424.   .br
  2425.   toggle reverse/not reverse order for output.
  2426. ! By default reverse=TRUE.
  2427.   .TP
  2428.   \f3-s\f2pagesize \f1
  2429. ! Spezify pagesize
  2430.   .br
  2431.   \f3-s1\f1:  executive         (7.25in * 10.5in)
  2432.   .br
  2433. ***************
  2434. *** 200,206 ****
  2435.   \f3-z\f1   
  2436.   .br
  2437.   print a test page with the page counter at end of job 
  2438. - (only for laserjet)
  2439.   .TP
  2440.   .br
  2441.   If no arguments are specified a short help file is displayed.
  2442. --- 189,194 ----
  2443. ***************
  2444. *** 210,221 ****
  2445.   .TP
  2446.   \f3\especial{file=<filename>}\f1
  2447.   copy specified file to the printer; either vector- or bitmap-graphics PMP 
  2448. ! commands (for laserjet and 3812)
  2449. ! .TP
  2450. ! \f3\especial{orientation=<value>}\f1
  2451. ! set page orientation to 0, 1, 2, 3;
  2452. ! rotate following output to landscape mode etc.
  2453. ! (3812 only).
  2454.   .TP 0
  2455.   others:
  2456.   There are a few other special commands implented for the LJ-series,
  2457. --- 198,204 ----
  2458.   .TP
  2459.   \f3\especial{file=<filename>}\f1
  2460.   copy specified file to the printer; either vector- or bitmap-graphics PMP 
  2461. ! commands
  2462.   .TP 0
  2463.   others:
  2464.   There are a few other special commands implented for the LJ-series,
  2465. ***************
  2466. *** 231,241 ****
  2467.   without the optional \f21\f1 or \f22\f1) 
  2468.   the following will happen after
  2469.   half of the pages is printed:
  2470. - .TP 6
  2471. - \f33812: \f1
  2472. - the printer beeps, shows message U1. An operator
  2473. - has to refill the printed pages into the paper tray and to
  2474. - push the continue button on the printer.
  2475.   .TP
  2476.   \f3LJ:\f1
  2477.   the printer stops, shows message "FEED" and switches
  2478. --- 214,219 ----
  2479. *** tfm.c.orig    Thu Mar  3 05:42:58 1994
  2480. --- tfm.c    Sat Apr  2 11:53:39 1994
  2481. ***************
  2482. *** 12,18 ****
  2483.   
  2484.   
  2485.   /* Defined in dvi2xx.c. */
  2486. ! extern long NoSignExtend ();
  2487.   #define TFM_GET_TWO()  NoSignExtend (tfm_fp, 2)
  2488.   #define TFM_GET_FOUR() NoSignExtend (tfm_fp, 4)
  2489.   
  2490. --- 12,18 ----
  2491.   
  2492.   
  2493.   /* Defined in dvi2xx.c. */
  2494. ! extern long4 NoSignExtend ();
  2495.   #define TFM_GET_TWO()  NoSignExtend (tfm_fp, 2)
  2496.   #define TFM_GET_FOUR() NoSignExtend (tfm_fp, 4)
  2497.   
  2498. ***************
  2499. *** 121,127 ****
  2500.     FILE *tfm_fp;
  2501.     unsigned char *header_data;
  2502.     unsigned char *width_raw; /* array of 1-byte data */
  2503. !   unsigned long *width_table; /* array of 4-byte fixes */
  2504.     unsigned i;
  2505.     unsigned lh, bc, ec, nw, nh, nd, ni, nl, nk, ne, np;
  2506.     char *full_name = kpse_find_tfm (name);
  2507. --- 121,127 ----
  2508.     FILE *tfm_fp;
  2509.     unsigned char *header_data;
  2510.     unsigned char *width_raw; /* array of 1-byte data */
  2511. !   unsigned long4 *width_table; /* array of 4-byte fixes */
  2512.     unsigned i;
  2513.     unsigned lh, bc, ec, nw, nh, nd, ni, nl, nk, ne, np;
  2514.     char *full_name = kpse_find_tfm (name);
  2515. ***************
  2516. *** 186,192 ****
  2517.     
  2518.     /* The width table is just nw words. */
  2519.     tfm_get_n (tfm_fp, nw, &width_raw);
  2520. !   width_table = (unsigned long *) xmalloc (nw * 4);
  2521.   
  2522.     /* But the width table contains four-byte numbers, so have to convert
  2523.        from BigEndian to host order. */
  2524. --- 186,192 ----
  2525.     
  2526.     /* The width table is just nw words. */
  2527.     tfm_get_n (tfm_fp, nw, &width_raw);
  2528. !   width_table = (unsigned long4 *) xmalloc (nw * 4);
  2529.   
  2530.     /* But the width table contains four-byte numbers, so have to convert
  2531.        from BigEndian to host order. */